renaming; show popup, if it is simple live template invokation by zen-coding shortcut...
[idea/community.git] / platform / lang-impl / src / com / intellij / codeInsight / template / impl / TemplateManagerImpl.java
index c6aac65a17825eff9122f21327f0d5cddbb25601..3b614337753ce828c46cdf64d47315ba9092811e 100644 (file)
@@ -227,7 +227,7 @@ public class TemplateManagerImpl extends TemplateManager implements ProjectCompo
     for (TemplateImpl template : template2argument.keySet()) {
       String argument = template2argument.get(template);
       int templateStart = getTemplateStart(template, argument, caretOffset, text);
-      if (templateStart <= offset) {
+      if (templateStart < offset) {
         return true;
       }
     }
@@ -251,9 +251,8 @@ public class TemplateManagerImpl extends TemplateManager implements ProjectCompo
             int offsetBeforeKey = caretOffset - key.length();
             CharSequence text = editor.getDocument().getCharsSequence();
             if (template2argument == null || !containsTemplateStartingBefore(template2argument, offsetBeforeKey, caretOffset, text)) {
-              callback.getEditor().getDocument().deleteString(offsetBeforeKey, caretOffset);
               customLiveTemplate.expand(key, callback);
-              callback.finish();
+              callback.startAllExpandedTemplates();
               return true;
             }
           }
@@ -325,7 +324,7 @@ public class TemplateManagerImpl extends TemplateManager implements ProjectCompo
     return candidate2Argument;
   }
 
-  private boolean startNonCustomTemplates(Map<TemplateImpl, String> template2argument,
+  public boolean startNonCustomTemplates(Map<TemplateImpl, String> template2argument,
                                           Editor editor,
                                           PairProcessor<String, String> processor) {
     final int caretOffset = editor.getCaretModel().getOffset();
@@ -353,7 +352,7 @@ public class TemplateManagerImpl extends TemplateManager implements ProjectCompo
 
   public static List<TemplateImpl> findMatchingTemplates(CharSequence text,
                                                          int caretOffset,
-                                                         char shortcutChar,
+                                                         Character shortcutChar,
                                                          TemplateSettings settings,
                                                          boolean hasArgument) {
     String key;