File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
java/src/processing/mode/java/debug Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,9 @@ public synchronized void startTracking(Document doc) {
147147 return ; // line doesn't exist
148148 }
149149 String lineText = doc .getText (line .getStartOffset (), line .getEndOffset () - line .getStartOffset ());
150- // set tracking position at (=before) first non-white space character on line
150+ // set tracking position at (=before) first non-white space character on line,
151+ // or, if the line consists of entirely white spaces, just before the newline
152+ // character
151153 pos = doc .createPosition (line .getStartOffset () + nonWhiteSpaceOffset (lineText ));
152154 this .doc = doc ;
153155 doc .addDocumentListener (this );
@@ -222,7 +224,14 @@ protected static int nonWhiteSpaceOffset(String str) {
222224 return i ;
223225 }
224226 }
225- return str .length ();
227+
228+ /* If we've reached here, that implies the line consists of purely white
229+ * space. So return at a position just after the whitespace (i.e.,
230+ * just before the newline).
231+ *
232+ * The " - 1" part resolves issue #3552
233+ */
234+ return str .length () - 1 ;
226235 }
227236
228237 /**
You can’t perform that action at this time.
0 commit comments