[LyX/master] Correct caret position from the start

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sat Nov 21 18:25:26 UTC 2020


commit ba8ca0e38468c75ece9d19ca91b871acdbca55b3
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sat Nov 21 19:37:22 2020 +0100

    Correct caret position from the start
---
 src/BufferView.cpp               |    2 ++
 src/frontends/qt/GuiWorkArea.cpp |    5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index bb41759..db9329b 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -3065,6 +3065,8 @@ void BufferView::caretPosAndDim(Point & p, Dimension & dim) const
 		dim.wid = lyxrc.cursor_width;
 
 	p = getPos(cur);
+	// center fat carets horizontally
+	p.x_ -= dim.wid / 2;
 	p.y_ -= dim.asc;
 }
 
diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp
index c1f74f8..df0eda5 100644
--- a/src/frontends/qt/GuiWorkArea.cpp
+++ b/src/frontends/qt/GuiWorkArea.cpp
@@ -138,9 +138,8 @@ public:
 	{
 		if (dim.empty())
 			return;
-		// correction is (1) for horizontal scrolling and (2) for
-		// better positionning of large cursors.
-		int const xx = x - horiz_offset - dim.wid / 2;
+		// correction for horizontal scrolling
+		int const xx = x - horiz_offset;
 		int const lx = dim.height() / 3;
 
 		// draw caret box


More information about the lyx-cvs mailing list