IDEA-69872 "Reformat code" action should change cursor position

Restoring caret column after formatting only for the empty lines now
This commit is contained in:
Denis Zhdanov
2011-05-20 14:34:38 +04:00
parent 9b57bb4df2
commit 820446d937
@@ -172,8 +172,9 @@ public class CodeStyleManagerImpl extends CodeStyleManager {
CharSequence text = document.getCharsSequence();
int caretLine = document.getLineNumber(caretOffset);
int lineStartOffset = document.getLineStartOffset(caretLine);
int lineEndOffset = document.getLineEndOffset(caretLine);
boolean fixCaretPosition = true;
for (int i = Math.min(caretOffset, text.length() - 1); i>= lineStartOffset; i--) {
for (int i = lineStartOffset; i < lineEndOffset; i++) {
char c = text.charAt(i);
if (c != ' ' && c != '\t' && c != '\n') {
fixCaretPosition = false;