diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java index e79090729741..298b8601441d 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java @@ -125,7 +125,17 @@ public class TemplateState implements Disposable { public void beforeCommandFinished(CommandEvent event) { if (started) { - afterChangedUpdate(); + Runnable runnable = new Runnable() { + public void run() { + afterChangedUpdate(); + } + }; + final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(myEditor); + if (lookup != null) { + lookup.performGuardedChange(runnable); + } else { + runnable.run(); + } } } };