On Saturday, November 7, 2020 at 6:42:42 AM UTC-6, Edward K. Ream wrote:

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.
>

Work has gone surprisingly well. PR 1725 gives the full details.

The first phase is nearing completion.  It simplifies the logic concerning 
headlines. This is tricky because editing headlines involves *ephemeral *Qt 
"headline editor" widgets.

The key to eliminating kwargs was to create new 
u.before/afterChangeHeadline methods. These are specialized to headlines, 
thereby reducing the complexity of u.before/afterChangeNodeContents.

I headline code contained extremely ugly hacks, centering around the 
tree.revertHeadline and tree.revertVnode ivars.  These ivars are now gone. 
However, it is now possible to have changes revert with the following 
sequence of actions:

- Ctrl-I: New headline
- type abc
- *click* another node: the headline appears to stick.
- Double click abc node: the headline reverts to newHeadline

Note: The reversion does *not* happen when using Ctrl-H instead of the 
double click.

I am not at all upset or worried about this glitch. In fact, I would be 
more worried if the reversion *didn't* happen. Clearly, there was a reason 
for the previous hacks :-) I am fairly confident that I can fix this 
problem more cleanly than before.

*Summary*

The first phase of the cleanup focused on headlines. More work remains.

The second phase will clean up all the code relating to changing body text. 
This is the main focus of #1413 
<https://github.com/leo-editor/leo-editor/issues/1413>.

The second phase will not involve the difficulties with ephemeral headline 
widgets. Otoh, the second phase involves much more complex calling 
sequences. 

The clone-find commands are essential for the second phase. There is no 
other way to *organize* complex search results. In effect, cff makes me 
smarter, because it augments my memory for detail after detail.

#1413 is a worthy part of the sabbatical. It promises to greatly simplify 
how Leo (and external scripts) handle changes to body text. 

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/75c608e7-dda3-492b-b5d2-9b6efe3289c2o%40googlegroups.com.

Reply via email to