The goal of #1413 <https://github.com/leo-editor/leo-editor/issues/1413> is to simplify Leo's undo api so that it is easier to write macro-like scripts.
The first thought was to continue the ongoing elimination of kwargs (keyword args) by eliminating kwargs from c.updateBodyPane, LeoBody.onBodyChanged, u.setUndoTypingParams, and others. This is not going to be a typical refactoring! Imo, it would not be possible at all without the clone-find commands. Even with those commands, the complications are dizzying. In particular, LeoTree.onHeadChanged contains the comment "Tricky code: do not change without careful thought and testing". The code is tricky because there are two paths through the code. The code can be called via event handlers (path one) or programmatically from Leo's core or user scripts (path two). The assumptions of the two paths are different. As I write this, I see that it might be best to use two completely separate sets of code for each path, that is, one set for event handlers and one set for scripts. We shall see whether this is possible or desirable. At present, unit tests might not actually find problems in the revised code, because unit tests run with the null (string-based) gui, not the actual Qt gui. Imo, the crucial unit tests will have to be run with the Qt gui. *Summary* Simplifying how scripts handle undo is worth a lot of work. This work will be tricky and dangerous. I do plan to work on #1413 during the sabbatical, just for fun and as a break from endless study :-) Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/1b8637e0-caae-46c6-8f65-cac646e30cd2o%40googlegroups.com.