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

Richard Kimberly Heck rikiheck at lyx.org
Thu Mar 12 13:55:33 UTC 2020


On 3/11/20 10:24 PM, Scott Kostyshak wrote:
> On Wed, Mar 11, 2020 at 07:56:02PM -0400, Scott Kostyshak wrote:
>> On Wed, Mar 11, 2020 at 10:16:10PM +0100, Jean-Marc Lasgouttes wrote:
>>> Le 11/03/2020 à 21:03, Scott Kostyshak a écrit :
>>>> 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.
>>> Indeed my point is that the icons should do the same think as the key
>>> bindings. Unless one has a pretty good reason. The best way to do it is to
>>> have the buttons call the lfuns.
>> OK I'll take a look at the buttons. They do call the LFUNs but I think
>> they do something before/after.
> The cursor move happens because of the commented out call to goTo() in
> the following TocWidget::outline() chunk:
>
>   diff --git a/src/frontends/qt/TocWidget.cpp b/src/frontends/qt/TocWidget.cpp
>   index 4c69aa3ba5..d0de03fadc 100644
>   --- a/src/frontends/qt/TocWidget.cpp
>   +++ b/src/frontends/qt/TocWidget.cpp
>   @@ -350,7 +350,7 @@ void TocWidget::outline(FuncCode func_code)
>           gui_view_.activateWindow();
>   
>           enableControls(false);
>   -       goTo(list[0]);
>   +//     goTo(list[0]);
>           sendDispatch(FuncRequest(func_code));
>           enableControls(true);
>           gui_view_.setFocus();
>
> I don't understand this code so I'm not sure what to do.

I'm not sure why that's there, but the reason it has this kind of effect
is because goTo calls dispatch, and we end up going through the dispatch
machinery again.

Riki




More information about the lyx-devel mailing list