Suggestions: Undo history and enlarged search history
-
- It would be useful to be able to right-click the Undo button, see all the history of recent operations and be able to revert to any point in that history, as is the case in many other applications (and same with Redo, obviously).
- It would also be great to be able to customize the size of the Search history, I’d like it to be much longer so that complex RegEx searches wouldn’t disappear so fast.
-
-
In a recent topic, there was a script for the PythonScript plugin that detailed the edit history for a particular file. If you were willing to put in effort, you could start with that script, and then expand it to do something (undo and redo) with that history, rather than just displaying it. And if he was interested, @Mark-Olson might even tweak it in that direction, since he seemed interested in that original idea.
-
You already can customize the search-history length using the config file, as described in the user manual’s “advanced preferences” section – it can be set anywhere up to 30 (the author felt that was enough for any reasonable need, and was unwilling to push it beyond that limit).
-
-
So I did a bit of digging related to this topic, and it looks like binding a callback to SCN_MACRORECORD would allow you to record the history of changes in a way that treats a find/replace action as a single action rather than as a series of insertions and deletions of characters (which my modification log script currently does).
The catch?
SCN_MACRORECORD
notifications only fire when a macro is being recorded. This means that any script that wanted to record find/replace actions would have to start recording a macro when it was first run, and it could not stop recording the macro until it stopped. This means that such a script would prevent you from using the macro recorder in a normal way.I don’t think it would be too difficult to implement such a script or plugin, but it’s important to understand the tradeoffs.EDIT: I tried using PythonScript to print
SCN_MACRORECORD
notifications (just a simpleeditor.callback(lambda notif: print(notif), [SCINTILLANOTIFICATION.MACRORECORD])
), and I found that find/replace actions don’t trigger those notifications in PythonScript. This is obviously really weird, because find/replace actions are clearly macroable. So I’m not too sure that Ariel’s idea is really do-able, at least in PythonScript.