mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 22:11:40 +07:00
smart enter to always insert a new line after the current, not before (IDEA-75554)
This commit is contained in:
@@ -2,7 +2,7 @@ public class Foo {
|
||||
{
|
||||
for(int i = 0; i < 100; i++) {
|
||||
x = 3;
|
||||
<caret>
|
||||
}
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
public class Foo {
|
||||
{
|
||||
<caret>
|
||||
for (int i = 0; i < 100; i++) {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
public class Foo {
|
||||
{
|
||||
<caret>
|
||||
x = 3;
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
public class Test {
|
||||
{
|
||||
x = 2;
|
||||
<caret>
|
||||
foo();
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -69,11 +69,7 @@ public class SmartEnterAction extends EditorAction {
|
||||
|
||||
final int caretOffset = editor.getCaretModel().getOffset();
|
||||
if (isInPreceedingBlanks(editor)) {
|
||||
final int caretLine = doc.getLineNumber(caretOffset);
|
||||
if (caretLine > 0) {
|
||||
int prevLineEnd = doc.getLineEndOffset(caretLine - 1);
|
||||
editor.getCaretModel().moveToOffset(prevLineEnd);
|
||||
}
|
||||
editor.getCaretModel().moveToOffset(doc.getLineEndOffset(doc.getLineNumber(caretOffset)));
|
||||
EditorActionHandler enterHandler = EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_ENTER);
|
||||
enterHandler.execute(editor, dataContext);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user