Skip to content

Commit 4abf16a

Browse files
committed
Fix #2004 - Indent breaks when hitting enter before spaces
1 parent 90358c2 commit 4abf16a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/src/processing/mode/java/PdeKeyListener.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,11 @@ public boolean keyPressed(KeyEvent event) {
304304
//textarea.setSelectionStart(origIndex + 1);
305305
textarea.setSelectionEnd(textarea.getSelectionStop() - spaceCount);
306306
textarea.setSelectedText("\n");
307+
textarea.setCaretPosition(textarea.getCaretPosition() + extraCount + spaceCount);
307308
} else {
308309
String insertion = "\n" + spaces(spaceCount);
309310
textarea.setSelectedText(insertion);
311+
textarea.setCaretPosition(textarea.getCaretPosition() + extraCount);
310312
}
311313

312314
// not gonna bother handling more than one brace

0 commit comments

Comments
 (0)