From 942fd02842b5238219e7fa5ab1e1340fddb83bb8 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Fri, 23 Jan 2015 14:06:48 +0300 Subject: [PATCH] give a chance to rebuild ranges after removing to support immediate editing of end after start --- .../editorActions/XmlTagNameSynchronizer.java | 1 + .../codeInsight/completion/XmlSyncTagTest.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagNameSynchronizer.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagNameSynchronizer.java index fbea7a3c3320..8d1e3638dc40 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagNameSynchronizer.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlTagNameSynchronizer.java @@ -218,6 +218,7 @@ public class XmlTagNameSynchronizer extends CommandAdapter implements Applicatio } if (!fitsInMarker) { clearMarkers(); + beforeDocumentChange(event); } } diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java index a55b1dc956cc..5c12e528b5a3 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlSyncTagTest.java @@ -34,6 +34,13 @@ public class XmlSyncTagTest extends LightPlatformCodeInsightFixtureTestCase { doTest("
>", "v", ""); } + public void testStartToEndAndEndToStart() { + doTest(">
", "v", ""); + myFixture.getEditor().getCaretModel().moveToOffset(12); + type("\b"); + myFixture.checkResult("
"); + } + public void testLastCharDeleted() { doTest(">", "\b\b\b", "<>"); } @@ -94,6 +101,11 @@ public class XmlSyncTagTest extends LightPlatformCodeInsightFixtureTestCase { private void doTest(final String text, final String toType, final String result) { myFixture.configureByText(XmlFileType.INSTANCE, text); + type(toType); + myFixture.checkResult(result); + } + + private void type(String toType) { for (int i = 0; i < toType.length(); i++) { final char c = toType.charAt(i); CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() { @@ -108,7 +120,6 @@ public class XmlSyncTagTest extends LightPlatformCodeInsightFixtureTestCase { } }, "Typing", DocCommandGroupId.noneGroupId(myFixture.getEditor().getDocument()), myFixture.getEditor().getDocument()); } - myFixture.checkResult(result); } private void doTestCompletion(final String text, final String toType, final String result) {