]> git.lyx.org Git - features.git/commitdiff
Fix display of caret completion indicator
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 13 Oct 2020 15:09:33 +0000 (17:09 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 13 Oct 2020 15:09:33 +0000 (17:09 +0200)
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

index 0d91e2acca6d57661b36888a52605dd62b8451b5..5937ae9707d7b2a0f62b66fd3283fc2ec875995c 100644 (file)
@@ -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);
                }
        }