mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
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:
+2
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user