CPP-4184 Generate multiple '}' on enter for code with several '{' in one line (method rename)

This commit is contained in:
Alexey Utkin
2015-11-24 17:46:53 +03:00
parent f5e2f4c5e1
commit 7223fa5c9f
@@ -67,7 +67,7 @@ public class EnterAfterUnmatchedBraceHandler extends EnterHandlerDelegateAdapter
insertRBraces(file, editor,
caretOffset,
getRBraceOffset(file, editor, caretOffset),
adjustRBraceCountForPosition(editor, caretOffset, maxRBraceCount));
generateStringToInsert(editor, caretOffset, maxRBraceCount));
return Result.DefaultForceIndent;
}
return Result.Continue;
@@ -110,7 +110,8 @@ public class EnterAfterUnmatchedBraceHandler extends EnterHandlerDelegateAdapter
* @param maxRBraceCount the maximum number of '}' for insert at position, it always positive
* @return the string of '}' that has to be inserted by handler, it must have at least one '}'
*/
protected String adjustRBraceCountForPosition(@NotNull final Editor editor, int caretOffset, int maxRBraceCount) {
@NotNull
protected String generateStringToInsert(@NotNull final Editor editor, int caretOffset, int maxRBraceCount) {
assert maxRBraceCount > 0;
CharSequence text = editor.getDocument().getCharsSequence();