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) {