On Friday, June 2, 2017 at 10:26:41 AM UTC-5, Edward K. Ream wrote:

> I am back at work on the curses gui project.  Key handling is insanely 
complicated, much as in Leo itself.

This weekend's work has been full of tedious, picky details.  Happily, the 
results are fairly good:

The various classes now *set* their bindings rather than *add to* their 
bindings. This makes the intent of the code clearer and prevents unintended 
interactions.  The Log and Body pane now work tolerably well, and in the 
same way, as follows:

*Outer mode (not editing)*: Only the following bindings are in effect:

- e: enter edit mode.
- d: delete the presently selected line.
- tab and shift-tab: select another pane.
- up/down arrows: select another line.
- page up/down keys: select another line.

No other printable character does anything, which eliminates confusion and 
odd behaviour.

*Edit mode*: This takes getting used to. I would like to change it, but 
that's beyond my abilities at present. Edit mode defines a *range* of lines 
that are being edited.  Hitting return extends the range.  Initially, the 
range consists of a single line, with the cursor at the end of the line.

Moving outside the range with up/down arrow keys *ends editing*. It's not 
always clear what the range of lines is, or whether edit mode is in 
effect.  To fix the latter problem, the surrounding pane now says "Body 
Pane (editing)" or "Log Pane (editing)" when edit mode is in effect.

It *is* possible to add new lines when editing, but at present the new 
"empty" line must end in a blank(!!). It seems impossible to delete a line 
(that is a newline) in editing mode.  That's why there is the 'd' binding 
in outer mode.

Imo, the various body editing classes are far from great, but short of a 
complete rewrite I am stuck trying to make do with what exists.

*Summary*

The present operation of the body and log panes will do for now. The 
results of all this difficult and picky work look like perfectly ordinary 
and straightforward code. In fact, it is the interactions between bindings 
that are important, and those interactions are hidden in plain sight in 
various binding tables.

The crucial last steps are making sure that the screen always stays in sync 
with Leo's underlying data structures. This involves updating those 
structures whenever the outline or body pane changes.  Only a few (tricky?) 
lines of code will be involved.

I hope to have the curses gui fit for real testing in a day or three.  At 
that time I'll re-enable the save command.  When that happens the curses 
gui will become quite dangerous, as I've explained before.

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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to