From 7b86f933205f50767ef94677a86754fdabfbf2f0 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 22 Dec 2011 12:59:34 +0100 Subject: [PATCH] correct indent on enter in multiline non-g-strings --- .../lang/editor/actions/GroovyEnterHandler.java | 2 +- .../groovy/lang/formatter/EnterActionTest.groovy | 1 + .../testdata/groovy/enterAction/multilineIndent.test | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 plugins/groovy/testdata/groovy/enterAction/multilineIndent.test diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/editor/actions/GroovyEnterHandler.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/editor/actions/GroovyEnterHandler.java index fa71dc1494e5..8e3748d4d660 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/editor/actions/GroovyEnterHandler.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/editor/actions/GroovyEnterHandler.java @@ -247,7 +247,7 @@ public class GroovyEnterHandler extends EnterHandlerDelegateAdapter { EditorModificationUtil.insertStringAtCaret(editor, "\n"); } else { - EditorModificationUtil.insertStringAtCaret(editor, "\n"); + originalHandler.execute(editor, dataContext); } return true; } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/formatter/EnterActionTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/formatter/EnterActionTest.groovy index b6360417d556..2660e3cbd008 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/formatter/EnterActionTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/formatter/EnterActionTest.groovy @@ -77,6 +77,7 @@ public class EnterActionTest extends GroovyFormatterTestCase { public void testGstring7() throws Throwable { doTest(); } public void testGstring8() throws Throwable { doTest(); } public void testGstring9() throws Throwable { doTest(); } + public void testMultilineIndent() throws Throwable { doTest(); } public void testSpaces1() throws Throwable { doTest(); } public void testString1() throws Throwable { doTest(); } public void testString2() throws Throwable { doTest(); } diff --git a/plugins/groovy/testdata/groovy/enterAction/multilineIndent.test b/plugins/groovy/testdata/groovy/enterAction/multilineIndent.test new file mode 100644 index 000000000000..8d65d37f1469 --- /dev/null +++ b/plugins/groovy/testdata/groovy/enterAction/multilineIndent.test @@ -0,0 +1,12 @@ +''' +class Foo { + void foo() {} +} +''' +----- +''' +class Foo { + void foo() {} + +} +''' \ No newline at end of file