[LyX/master] Improve caret position when splitting a view

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sat Sep 2 14:05:06 UTC 2023


commit e651e15a99721ea0611f12550a14316b1e890da9
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Fri Sep 1 19:36:45 2023 +0200

    Improve caret position when splitting a view
    
    The old code only worked for toplevel cursors and did not show current cursor.
    Note that the two windows do not have exactly the same offset.
    
    Fixes bug #12689.
---
 src/frontends/qt/GuiView.cpp |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 579fb35..c9a9ff8 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -4879,12 +4879,8 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 			TabWorkArea * twa = addTabWorkArea();
 			GuiWorkArea * wa = twa->addWorkArea(*doc_buffer, *this);
 
-			// set cursor to same position as current view.
-			// TODO: would be good to *scroll* to same position also
-			//       so that the display is the same (#12689)
-			DocIterator cur = bv->cursor();
-			wa->bufferView().moveToPosition(cur.pit(), cur.pos(), 0, 0);
-
+			wa->bufferView().setCursor(bv->cursor());
+			dr.screenUpdate(Update::ForceAll | Update::FitCursor);
 			setCurrentWorkArea(wa);
 			break;
 		}


More information about the lyx-cvs mailing list