From 1e8614b67add9b7232184cca616a0d6fc487fd20 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Fri, 28 Mar 2014 14:03:45 +0400 Subject: [PATCH] IDEA-120785 Multiline select issue --- .../codeInsight/editorActions/XmlEqTypedHandler.java | 5 +++-- .../codeInsight/completion/XmlTypedHandlersTest.java | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java index e483f34b61c5..35080e98b9e5 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java @@ -55,8 +55,9 @@ public class XmlEqTypedHandler extends TypedHandlerDelegate { @Override public Result charTyped(char c, Project project, @NotNull Editor editor, @NotNull PsiFile file) { for (Caret caret : caretsForInsertingQuotes) { - editor.getDocument().insertString(caret.getOffset(), "\"\""); - caret.moveCaretRelatively(1, 0, false, true); + int offset = caret.getOffset(); + editor.getDocument().insertString(offset, "\"\""); + caret.moveToOffset(offset + 1); } if (editor.getCaretModel().getAllCarets().size() == caretsForInsertingQuotes.size()) { AutoPopupController.getInstance(project).scheduleAutoPopup(editor); diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java index 6d2f3724e040..a4f6c2ac20df 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlTypedHandlersTest.java @@ -32,6 +32,10 @@ public class XmlTypedHandlersTest extends LightPlatformCodeInsightFixtureTestCas doTest(">>", '=', "\">\">"); } + public void testValueQuotesWithMultiCaretsMultiline() { + doTest("\n", '=', "\"\n\""); + } + public void testValueQuotesWithMultiCaretsWithDifferentContexts() { doTest(">>", '=', ">\">"); }