"Random" de-hoist

61 views
Skip to first unread message

Phil

unread,
Sep 4, 2021, 11:15:30 AM9/4/21
to leo-editor
When working in a hoisted tree, I occasionally experience "random" de-hoisting. It's not really random, as it only occurs when I'm typing. And I'm not a great typist, so it is certainly possible - likely! - that my fat fingers are the culprit. But... I have looked through all my settings to find the key-combination that I may be inadvertently hitting, and I don't see how I can be causing this; Ctrl-Alt-Shift-h and Alt-O-H-E are quite specific combinations, that seem highly unlikely to be hit at random. One other possible factor is that I have defined Hoist/Dehoist buttons as I use these frequently; but these require a mouse click to operate, and I lack the dexterity to be mousing and typing at the same time!

Any ideas?

Here's what I'm running:

Leo 6.2.1 final
Python 3.7.3, PyQt version 5.12.4
linux

Thanks!
Phil

Edward K. Ream

unread,
Sep 4, 2021, 12:34:52 PM9/4/21
to leo-editor
On Sat, Sep 4, 2021 at 10:15 AM Phil <phil....@gmail.com> wrote:
When working in a hoisted tree, I occasionally experience "random" de-hoisting.
... 
Any ideas?

The view-lossage command shows the last keystrokes you typed.

Edward

Phil

unread,
Sep 6, 2021, 10:13:34 PM9/6/21
to leo-editor
Thanks for that Edward. I had a "random dehoist" again. Here's the sequence of events I captured. I don't see any obvious reason why the tree should dehoist. Hopefully this makes sense, and is helpful for you.

================

This is the text I was editing, in one node, typing line N, then copying text from another node and pasting it as line N+1.

    line N:      local level = t[2]
    line N+1:    print(indent_text(tostring(s), 2*level))


Here's the view-lossage output; I've added annotations to the right:

l              {start typing line N}
o
c
a
l
Space
l
e
v
e
l
Space
=
Space
[
2
]
BackSpace      {noticed the error, backspaced to correct it}
BackSpace
BackSpace
t
[
2
]              {finished typing line N}
Return         {after the Return, I clicked on another node to copy and paste some code}
Ctrl+c         {selected text with the mouse, copied it, then clicked back to the target node}
Ctrl+v         {pasted the text}
Ctrl+s         {saved, as I do frequently - it is here that my hoisted subtree dehoisted}
v
i
e
w
-
l
o
s
s
a
g
e
Return


Edward K. Ream

unread,
Sep 7, 2021, 4:49:46 AM9/7/21
to leo-editor
On Mon, Sep 6, 2021 at 9:13 PM Phil <phil....@gmail.com> wrote:
Thanks for that Edward. I had a "random dehoist" again. Here's the sequence of events I captured.

Thanks. Just yesterday I converted a unit test involving dehoist, and discussed this issue with Félix on zoom. There are significant edge cases involved.

I don't see any obvious reason why the tree should dehoist. Hopefully this makes sense, and is helpful for you.

Yes, it's helpful. Hoists affect all of Leo's generators. If a generator returns a node outside of the hoisted area a dehoist will (probably :-) happen.

Félix made an interesting remark yesterday: Fixing any difficult (apparently random) bug instantly becomes straightforward once we know the exact sequence of events that triggers the bug.

Edward

Edward K. Ream

unread,
Sep 7, 2021, 4:57:27 AM9/7/21
to leo-editor
On Mon, Sep 6, 2021 at 9:13 PM Phil <phil....@gmail.com> wrote:
Thanks for that Edward. I had a "random dehoist" again.

I have just created #2167, scheduled for Leo 6.4.

Edward

vitalije

unread,
Sep 8, 2021, 6:30:57 AM9/8/21
to leo-editor
I doubt that it has anything to do with your typing. Most likely hoisted position becomes invalid and Leo automatically de-hoist. As I see from your keys the last thing you have done is Ctrl-s. Have you altered this shortcut to execute some script or it is still attached to the Leo's save command? Perhaps you have some plugin that has registered an event handler to execute before or after the save. If any of these handlers change outline or if they select positions out of the hoisted subtree then Leo will automatically de-hoist.
Vitalije

Edward K. Ream

unread,
Sep 14, 2021, 6:32:40 PM9/14/21
to leo-editor
On Monday, September 6, 2021 at 9:13:34 PM UTC-5 Phil wrote:
 I had a "random dehoist" again. Here's the sequence of events I captured. [snip]

Do you ever use chapters?

Edward

Phil

unread,
Sep 15, 2021, 3:34:14 PM9/15/21
to leo-editor
No, I do not use chapters; I have both use_chapter_tabs and use_chapters set false in my settings.

Edward K. Ream

unread,
Sep 15, 2021, 5:56:31 PM9/15/21
to leo-editor
On Wed, Sep 15, 2021 at 2:34 PM Phil <phil....@gmail.com> wrote:
No, I do not use chapters; I have both use_chapter_tabs and use_chapters set false in my settings.

Thanks for the info. It helps.

Please let me know if anything "interesting" happens in the ekr-hoist-bug branch.

Edward
Reply all
Reply to author
Forward
0 new messages