From: Jean-Marc Lasgouttes Date: Wed, 27 Apr 2016 19:16:34 +0000 (+0200) Subject: Fix cursor position after redo X-Git-Tag: 2.3.0alpha1~1643^2~70 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5aa342ed75e7774734a2dcff8c219970ddeb5a7e;p=features.git Fix cursor position after redo When document settings are modified, a command inset-forall Branch inset-toggle asign is run to open as needed all branches. At the end of the said loop, the cursor is reset to where it was. However, the cur_after undo element member is not set because it already had a value. To make this work as expected, it is necessary in LFUN_INSET_FORALL to reset the cursor before ending the undo group and to insert a dummy recordUndo call. Fixes bug #10097. --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index c6c489f994..b2da99880a 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -1855,9 +1855,17 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr) if (!cur.nextInset() || cur.nextInset() == ins) cur.forwardInset(); } - cur.endUndoGroup(); cur = savecur; cur.fixIfBroken(); + /** This is a dummy undo record only to remember the cursor + * that has just been set; this will be used on a redo action + * (see ticket #10097) + + * FIXME: a better fix would be to have a way to set the + * cursor value directly, but I am not sure it is worth it. + */ + cur.recordUndo(); + cur.endUndoGroup(); dr.screenUpdate(Update::Force); dr.forceBufferUpdate();