[PATCH] outline-up/down: preserve cursor's position

Scott Kostyshak skostysh at lyx.org
Tue Mar 10 14:31:10 UTC 2020


On Tue, Mar 10, 2020 at 08:55:06AM +0100, Pavel Sanda wrote:
> On Tue, Mar 10, 2020 at 01:24:31AM -0400, Richard Kimberly Heck wrote:
> > On 3/9/20 9:25 PM, Scott Kostyshak wrote:
> > > Is there a reason to do the following for outline-up and outline-down?
> > >
> > >   setCursor(cur, cur.pit(), 0);
> > >
> > > It does not seem to be necessary in my testing, but I'm wondering if
> > > there's a case I'm missing. Or perhaps it is not necessary but is
> > > desired behavior for some reason?
> > >
> > > It has been this way for a long time, at least since 71f356c3.
> > >
> > > Attached is a patch to remove it so that the cursor position does not
> > > change when executing those actions.
> > 
> > Is there a concern that these actions might invalidate the cursor? Maybe
> 
> Will be the cursor invalidated when depth of the paragraph changes after the movement?

Thanks for taking a look, Riki and Pavel. I don't know the answers to
your questions. I tried to test regarding Pavel's concern, but I don't
know a situation when the depth changes; I think that these LFUNs might
be disabled when using them would change the depth. I'm not sure of that
though.

Perhaps the following be more reasonable and safer?

  setCursor(cur, cur.pit(), cur.pos());

The above seems safe since I'm just changing "0" to "cur.pos()", and I
don't see how the length of the paragraph can change after this
operation.

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200310/19a30fcd/attachment.asc>


More information about the lyx-devel mailing list