From e651e15a99721ea0611f12550a14316b1e890da9 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 1 Sep 2023 19:36:45 +0200 Subject: [PATCH] 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 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index 579fb35249..c9a9ff87fc 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; } -- 2.39.5