On Tuesday, May 23, 2017 at 5:17:34 PM UTC-5, Edward K. Ream wrote: > At last I am beginning to understand what is, and isn't, necessary.
You could call this post an Engineering Notebook post, but it may be of more general interest. This project looks to be almost complete, except for optional details like syntax coloring, tab completion in the minibuffer, etc. When I awoke this morning I realized that an ugly hack has a bigger meaning. The *get_nth_visible_position* method returns the nth visible node, in *Leo's* tree. It starts at the c.rootPosition() and calls p.moveToVisNext until it has reached the nth node. Nothing could be more simple minded. Yes, this is slow, but that doesn't matter, for several reasons: 1. In practice, few nodes are ever visible. 2. You could say that this single method *replaces* all the Qt tree-drawing code. Of course, the npyscreen tree drawing code still exists, so really this method actually replaces all the complex "item caching" logic in the Qt tree-drawing code. 3. There is no good alternative ;-) Without having npyscreen redraw the screen (and that *would* be expensive), there is no other way to associate areas on the screen (MLTree.cursor_line) with positions in the outline. Caching data (of any kind) wouldn't work because the cache must be invalidated on every redraw! As I write this, I see that get_nth_visible_position doesn't handle chapters and clones correctly. That will be easy to fix. I realized one more thing when I awoke. After the initial irritation with the twisty little maze of npyscreen code, I see that the npyscreen classes (and especially their data) have been surprisingly easy to use. The proof is in the LeoMLTree event handlers. All are perfectly straightforward. I'll have to congratulate the npyscreen folks. 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.
