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.
This commit is contained in:
Jean-Marc Lasgouttes 2023-09-01 19:36:45 +02:00
parent f833e5f184
commit e651e15a99

View File

@ -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;
}