[LyX/master] When splitting a bufferview, keep the scrollbar position
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Tue Sep 5 11:46:29 UTC 2023
commit 100e759f17e8abad66c7923e1737a7f41e8e5ca2
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Mon Sep 4 11:26:55 2023 +0200
When splitting a bufferview, keep the scrollbar position
This is actually better thean making sure that the cursor is visible.
Fixes bug #12689.
---
src/BufferView.cpp | 8 ++++++++
src/BufferView.h | 3 +++
src/frontends/qt/GuiView.cpp | 4 ++--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index 879beb0..ad534ea 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -337,6 +337,14 @@ BufferView::~BufferView()
}
+void BufferView::copySettingsFrom(BufferView const & bv)
+{
+ setCursor(bv.cursor());
+ d->anchor_pit_ = bv.d->anchor_pit_;
+ d->anchor_ypos_ = bv.d->anchor_ypos_;
+}
+
+
int BufferView::defaultMargin() const
{
// The value used to be hardcoded to 10
diff --git a/src/BufferView.h b/src/BufferView.h
index f816eda..d239fdd 100644
--- a/src/BufferView.h
+++ b/src/BufferView.h
@@ -108,6 +108,9 @@ public:
Buffer & buffer();
Buffer const & buffer() const;
+ /// Copy cursor and vertical offset information from \c bv
+ void copySettingsFrom(BufferView const & bv);
+
///
void setFullScreen(bool full_screen) { full_screen_ = full_screen; }
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index c9a9ff8..3723afe 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -4879,8 +4879,8 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
TabWorkArea * twa = addTabWorkArea();
GuiWorkArea * wa = twa->addWorkArea(*doc_buffer, *this);
- wa->bufferView().setCursor(bv->cursor());
- dr.screenUpdate(Update::ForceAll | Update::FitCursor);
+ wa->bufferView().copySettingsFrom(*bv);
+ dr.screenUpdate(Update::ForceAll);
setCurrentWorkArea(wa);
break;
}
More information about the lyx-cvs
mailing list