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

Scott Kostyshak skostysh at lyx.org
Wed Mar 11 20:03:06 UTC 2020


On Wed, Mar 11, 2020 at 03:48:04PM -0400, Richard Kimberly Heck wrote:
> On 3/11/20 3:12 PM, Jean-Marc Lasgouttes wrote:
> > Le 11/03/2020 à 19:14, Scott Kostyshak a écrit :
> >> commit adb7283b69f5dddfabb8d807a432cd1e5e60b221
> >> Author: Scott Kostyshak <skostysh at lyx.org>
> >> Date:   Wed Mar 11 14:18:33 2020 -0400
> >>
> >>      outline-up/down: preserve cursor's position
> >>           There is no need to change the cursor's position to the
> >> beginning of
> >>      the line.
> >>           This change does not affect the behavior of using the
> >> buttons in the
> >>      Outliner pane, but is useful for using the keyboard shortcuts.
> >
> > What is the difference between the two code paths?
> 
> One has OutlineUp and one has OutlineDown?

I'm glad I'm not the only one that originally interpretted JMarc's
comment like that. I made a patch thinking he was hinting that I should
combine the code to reduce duplication. See attached. Now I realize
that's not what he was trying to say, and I'm not sure the patch
actually makes things more clear.

I now realize he was referring to my commit message that the change does
not affect behavior in the Outliner pane. Regarding that interpretation,
if you click on a section in the outline, the cursor is automatically
moved to position 0 which makes sense in my opinion. Also, if you place
the cursor yourself in a section and then just click on the down arrow,
the cursor position is still moved to position 0. I'm not sure where
this latter behavior happens. I could take a look if we wanted to
consider removing it. Note that TocWidget.cpp still ends up calling the
LFUN handled by Text3 (i.e., the code touched by this commit), but I
guess the positioning is done before or after.

I'm happy to look into this further if I know what the ideal behavior
would be.

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Reduce-duplication-of-code.patch
Type: text/x-diff
Size: 1010 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200311/ae0c7839/attachment.patch>
-------------- 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/20200311/ae0c7839/attachment.asc>


More information about the lyx-devel mailing list