Find/Replace History Never Clears

Random Void User
Posts: 112
Joined: 13.07.2024 21:19

Find/Replace History Never Clears

Post by Random Void User »

Code: Select all

Help /
  Command palette ... /
    settings: clear find/replace dialog history
This command does not work as it should. It only temporarily clears the pop-up menu of all previous search items. Quit and restart Cud, the menu reappears.

The command should work like

Code: Select all

File /
  Open recent file /
    Clear list
which permanently removes all listings.

The find/replace list stores in two places. One is user.json, the other is cuda_find_replace_3rd_history.json. I do not understand the need for two locations. Recent files, for example, live only in user.json. Deleting the other file does not wipe the list, it gets reconstructed.
main Alexey
Posts: 3004
Joined: 25.08.2021 18:15

Re: Find/Replace History Never Clears

Post by main Alexey »

On _clean_ app (no additional plugs) I see that 'clear find/replace history' deletes in-memory lists + deletes 2 sections in the 'history.json': "list_find", "list_replace".
Maybe you see the issue only with the plugin "Find-Replace Separate History"?
main Alexey
Posts: 3004
Joined: 25.08.2021 18:15

Re: Find/Replace History Never Clears

Post by main Alexey »

added the new API for the plugin "Find-Replace Separate History".

on_state:
* APPSTATE_CLEAR_HISTORY_RECENTS: Running of the command "settings: clear recent file history".
* APPSTATE_CLEAR_HISTORY_FINDER: Running of the command "settings: clear find/replace dialog history".
* APPSTATE_CLEAR_HISTORY_CONSOLE: Running of the command "settings: clear console input history".

will be in the next update of Cud. then plugin will be updated and problem, maybe, will be fixed.
main Alexey
Posts: 3004
Joined: 25.08.2021 18:15

Re: Find/Replace History Never Clears

Post by main Alexey »

I wrote a note to the plugin author
https://github.com/ildarkhasanshin/cuda ... y/issues/5
let's wait few days.
_92
Posts: 26
Joined: 11.10.2012 10:57
Contact:

Re: Find/Replace History Never Clears

Post by _92 »

plugin updated
eat sleep code repeat
Random Void User
Posts: 112
Joined: 13.07.2024 21:19

Re: Find/Replace History Never Clears

Post by Random Void User »

OK, thanks. I forgot that I had this plugin installed. My setup has all plugins. And the main file was not user.json, sorry for my mistake.

History data categories should be stand-alone, not embedded into any common file. The reason is that simple file deletion then erases that history category. Clean-up is simple and intuitive. The plug-in perhaps shows people want separate files for other reasons, too. This plug-in is specific to find/replace, but any history data could be contemplated.

For me it's just about clearing history. I never find hand-editing a JSON stanza, or scripting JSON parsing, or remembering an obscure command in Help / Command palette, to be as easy as file deletion.

Another way to give users control is relocating history files outside of Cud settings folder, say in tmpfs. Then they disappear on reboot. It would be a user.json preference or command line switch to set the path. I think the pref, however implemented, should parse and expand environment variables. The user could then decide how to handle various history data types.

Thanks!
main Alexey
Posts: 3004
Joined: 25.08.2021 18:15

Re: Find/Replace History Never Clears

Post by main Alexey »

>History data categories should be stand-alone, not embedded into any common file.

is this suggestion for the Cud, or for the plugin? Cud's history is in the common file, like in other apps.


>relocating history files outside of Cud settings folder, say in tmpfs. Then they disappear on reboot.

tempps is OS specific. Cud must be cross platform.
why disappear on reboot? it is bad for me. I need persist history.
main Alexey
Posts: 3004
Joined: 25.08.2021 18:15

Re: Find/Replace History Never Clears

Post by main Alexey »

I guess the Batch/Shell script can be made, which calls some command-line tool to delete JSON sections.
ask Grok AI this:

>I need the command-line program which can change/delete sections/keys in JSON file
Random Void User
Posts: 112
Joined: 13.07.2024 21:19

Re: Find/Replace History Never Clears

Post by Random Void User »

> is this suggestion for the Cud, or for the plugin

For Cud. My point was that the plug-in would not need to exist if Cud already had the feature. Existence of the plug-in shows people want the feature.

> [ tmpfs ] is OS specific...why disappear on reboot? it is bad for me

It would be a user choice. It would not be the default. Consider the privacy implications of user history to understand why some users might like to have a setting. I will also point out here that RAM is 10x faster than disk access, so speed is another reason. I usually set my apps to put logs and history in tmpfs (RAM) for both reasons. They run a lot faster. However the default would just be separate history_XYZ files in Cud settings folder.

> I guess the Batch/Shell script can be made

Sure, jq or jaq tooling is possible. However those cannot be run reliably while Cud is open and seem unnecessary. It's easy to split off the history stanzas into separate files with user prefs to override default locations. I would even propose a subfolder called "history" holding these files.
main Alexey
Posts: 3004
Joined: 25.08.2021 18:15

Re: Find/Replace History Never Clears

Post by main Alexey »

So what you suggest is

a- move history lists to separate file (eg "history lists.json"), 4 lists as i see: "list_console"/"list_find"/"list_replace"/recents
b- add a cmd-line switch to change the folder of this new file

?

if b - why current cmd-line switch "-s=folder" is not ok?
Post Reply