X Tutup
Skip to content

Commit 956fee8

Browse files
committed
fix situations where caret sometimes leaves single pixel trails
1 parent c85f2f3 commit 956fee8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/src/processing/app/syntax/TextAreaPainter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.awt.Rectangle;
2020
import java.awt.RenderingHints;
2121
import java.awt.event.MouseEvent;
22+
import java.awt.geom.Line2D;
2223

2324
import javax.swing.ToolTipManager;
2425
import javax.swing.text.*;
@@ -589,7 +590,10 @@ protected void paintCaret(Graphics gfx, int line, int y) {
589590
// the first column. the fix is to use drawLine() in
590591
// those cases, as a workaround.
591592
if (caretWidth == 1) {
592-
gfx.drawLine(caretX, y, caretX, y + height - 1);
593+
// workaround for single pixel dots showing up when caret
594+
// is rendered a single pixel too tall [fry 220129]
595+
((Graphics2D) gfx).draw(new Line2D.Float(caretX, y + 0.5f, caretX, y + height - 0.5f));
596+
//gfx.drawLine(caretX, y, caretX, y + height - 1);
593597
} else {
594598
gfx.drawRect(caretX, y, caretWidth - 1, height - 1);
595599
}

todo.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ X users confirms the correctly working display swapped between beta 3 and 4
1818
X also updated the two older bugs
1919
X https://github.com/processing/processing4/issues/226
2020
X https://github.com/processing/processing4/issues/342
21-
21+
X caret is sometimes one pixel too tall
2222

2323
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2424

0 commit comments

Comments
 (0)
X Tutup