[LyX/master] Fix display of caret completion indicator

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Oct 13 14:47:18 UTC 2020


commit 310c94c48c563b5dbe0564721c2f8356f933a42f
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Tue Oct 13 17:09:33 2020 +0200

    Fix display of caret completion indicator
    
    The zooming algorithm based on caret width was deeply flawed. It is
    not replaced with a formula based on caret height.
    
    Fixes bug #12000.
---
 src/frontends/qt/GuiWorkArea.cpp |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp
index 0d91e2a..5937ae9 100644
--- a/src/frontends/qt/GuiWorkArea.cpp
+++ b/src/frontends/qt/GuiWorkArea.cpp
@@ -79,8 +79,6 @@
 #include <cmath>
 #include <iostream>
 
-int const TabIndicatorWidth = 3;
-
 #undef KeyPress
 #undef NoModifier
 
@@ -165,13 +163,14 @@ public:
 		// draw completion triangle
 		if (completable) {
 			int const m = y + dim.height() / 2;
-			int const d = TabIndicatorWidth * dim.wid - 1;
+			int const d = dim.height() / 8;
 			// offset for slanted carret
 			int const sx = (dim.asc - (dim.height() / 2 - d)) * slope;
-			painter.drawLine(xx + dir * (dim.wid + 1) + sx, m - d,
-			                 xx + dir * (dim.wid + d + 1) + sx, m);
-			painter.drawLine(xx + dir * (dim.wid + 1) + sx, m + d,
-			                 xx + dir * (dim.wid + d + 1) + sx, m);
+			painter.setPen(QPen(color, dim.width()));
+			painter.drawLine(xx + dir * dim.wid + sx, m - d,
+			                 xx + dir * (dim.wid + d) + sx, m);
+			painter.drawLine(xx + dir * dim.wid + sx, m + d,
+			                 xx + dir * (dim.wid + d) + sx, m);
 		}
 	}
 


More information about the lyx-cvs mailing list