From 956fee8b4a658ecfa952eb90f6f736bf28a4dccd Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sat, 29 Jan 2022 13:02:43 -0500 Subject: [PATCH] fix situations where caret sometimes leaves single pixel trails --- app/src/processing/app/syntax/TextAreaPainter.java | 6 +++++- todo.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/processing/app/syntax/TextAreaPainter.java b/app/src/processing/app/syntax/TextAreaPainter.java index c3fc76923..e68144cf1 100644 --- a/app/src/processing/app/syntax/TextAreaPainter.java +++ b/app/src/processing/app/syntax/TextAreaPainter.java @@ -19,6 +19,7 @@ import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.event.MouseEvent; +import java.awt.geom.Line2D; import javax.swing.ToolTipManager; import javax.swing.text.*; @@ -589,7 +590,10 @@ public class TextAreaPainter extends JComponent implements TabExpander { // the first column. the fix is to use drawLine() in // those cases, as a workaround. if (caretWidth == 1) { - gfx.drawLine(caretX, y, caretX, y + height - 1); + // workaround for single pixel dots showing up when caret + // is rendered a single pixel too tall [fry 220129] + ((Graphics2D) gfx).draw(new Line2D.Float(caretX, y + 0.5f, caretX, y + height - 0.5f)); + //gfx.drawLine(caretX, y, caretX, y + height - 1); } else { gfx.drawRect(caretX, y, caretWidth - 1, height - 1); } diff --git a/todo.txt b/todo.txt index 92af16475..ae18277d9 100755 --- a/todo.txt +++ b/todo.txt @@ -18,7 +18,7 @@ X users confirms the correctly working display swapped between beta 3 and 4 X also updated the two older bugs X https://github.com/processing/processing4/issues/226 X https://github.com/processing/processing4/issues/342 - +X caret is sometimes one pixel too tall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .