mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Commit document when necessary
This commit is contained in:
+7
-3
@@ -49,9 +49,13 @@ public class EnterBetweenBracesHandler extends EnterHandlerDelegateAdapter {
|
||||
int prevCharOffset = CharArrayUtil.shiftBackward(text, caretOffset - 1, " \t");
|
||||
int nextCharOffset = CharArrayUtil.shiftForward(text, caretOffset, " \t");
|
||||
|
||||
if (!isValidOffset(prevCharOffset, text) || !isValidOffset(nextCharOffset, text) ||
|
||||
!isBracePair(text.charAt(prevCharOffset), text.charAt(nextCharOffset)) ||
|
||||
file.findElementAt(prevCharOffset) == file.findElementAt(nextCharOffset)) {
|
||||
if (!isValidOffset(prevCharOffset, text) || !isValidOffset(nextCharOffset, text) ||
|
||||
!isBracePair(text.charAt(prevCharOffset), text.charAt(nextCharOffset))) {
|
||||
return Result.Continue;
|
||||
}
|
||||
|
||||
PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument());
|
||||
if (file.findElementAt(prevCharOffset) == file.findElementAt(nextCharOffset)) {
|
||||
return Result.Continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user