Fix #2004 - Indent breaks when hitting enter before spaces

This commit is contained in:
AmnonOwed
2014-08-01 00:10:31 +02:00
parent 90358c22ca
commit 4abf16acc5

View File

@@ -304,9 +304,11 @@ public class PdeKeyListener {
//textarea.setSelectionStart(origIndex + 1);
textarea.setSelectionEnd(textarea.getSelectionStop() - spaceCount);
textarea.setSelectedText("\n");
textarea.setCaretPosition(textarea.getCaretPosition() + extraCount + spaceCount);
} else {
String insertion = "\n" + spaces(spaceCount);
textarea.setSelectedText(insertion);
textarea.setCaretPosition(textarea.getCaretPosition() + extraCount);
}
// not gonna bother handling more than one brace