smart enter to always insert a new line after the current, not before (IDEA-75554)

This commit is contained in:
peter
2011-10-19 15:22:09 +02:00
parent e142fd0ff4
commit eb47e1d111
5 changed files with 5 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ public class Foo {
{
for(int i = 0; i < 100; i++) {
x = 3;
<caret>
}
<caret>
}
}

View File

@@ -1,7 +1,7 @@
public class Foo {
{
<caret>
for (int i = 0; i < 100; i++) {
<caret>
}
}
}

View File

@@ -1,6 +1,6 @@
public class Foo {
{
<caret>
x = 3;
<caret>
}
}

View File

@@ -1,7 +1,7 @@
public class Test {
{
x = 2;
<caret>
foo();
<caret>
}
}

View File

@@ -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;