Does anyone use math inset locking?
Richard Kimberly Heck
rikiheck at gmail.com
Tue Dec 5 20:08:57 UTC 2023
On 12/5/23 14:40, Scott Kostyshak wrote:
> I came across what I thought was a bug. In the attached, if I put the
> cursor just inside the note and press ctrl + i for inset-toggle, I
> expected the note to close.
>
> I looked around in the code, and I found an interesting chunk in InsetMathNest.cpp:
>
> // 'Locks' the math inset. A 'locked' math inset behaves as a unit
> // that is traversed by a single <CursorLeft>/<CursorRight>.
> case LFUN_INSET_TOGGLE:
> cur.recordUndo();
> lock(!lock());
> cur.popForward();
> break;
>
> I don't know if that is actually related to the issue I was looking at,
> but I had never heard of this feature. Does anyone use it? Can someone
> give me an example of a case where it is used? Is it indeed saved in the
> file format? I think I might find this feature useful.
I had never heard of this, but I can see how it would make cursor
movement easier. As far as I can see, though, it is not working as
intended, and it does not seem to be saved in the file.
I am guessing that your cursor was just before the math inset. This LFUN
operates 'at point', meaning that, if the cursor is just before an
inset, then it will affect that inset, rather than the one it is 'in'.
This is more or less essential: How can you open a footnote otherwise?
But it can lead to somewhat surprising behavior in some cases.
Riki
More information about the lyx-devel
mailing list