Merge pull request #2690 from AmnonOwed/Fix2004-IndentBreaksOnEnterBeforeSpaces

Fix #2004 - Indent breaks when hitting enter before spaces
This commit is contained in:
Ben Fry
2014-07-31 18:40:34 -04:00

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