From 80cae7e65a032a9f3229a121423d8d745962fe98 Mon Sep 17 00:00:00 2001 From: Akarshit Wal Date: Wed, 15 Apr 2015 22:28:59 +0530 Subject: [PATCH] Now the cursor moves when the line is changed after a long line --- app/src/processing/app/syntax/JEditTextArea.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java index 9cf6ecfd2..7834258c1 100644 --- a/app/src/processing/app/syntax/JEditTextArea.java +++ b/app/src/processing/app/syntax/JEditTextArea.java @@ -563,11 +563,11 @@ public class JEditTextArea extends JComponent int width = painter.getFontMetrics().charWidth('w'); if(x < 0) { - newHorizontalOffset = Math.min(0,horizontalOffset - x + width + 5); + newHorizontalOffset = Math.max(0,horizontalOffset - x + width + 5); } else if(x + width >= painter.getWidth()) { newHorizontalOffset = horizontalOffset + (painter.getWidth() - x) - width - 5; - } + } return setOrigin(newFirstLine,newHorizontalOffset); }