def on_post_text_command(self, view, command_name, args):
     if len( view.sel() ) < 1:
         return
     current_line = Selection.get_line(view)
     command_trigger = command_name in settings.get("trigger_action", []) and self.track_insert["start_line"] != current_line
     if command_trigger or command_name in settings.get("insert_action", []):
         self.finish_tracking(view, command_name)
         self.on_post_insert_completion(view, command_name)
Esempio n. 2
0
 def start_tracking(self, view, command_name=None):
     self.track_insert["active"] = True
     self.track_insert["start_line"] = Selection.get_line(view)
     """
         - sublime inserts completions by replacing the current word
         - this results in wrong path insertions if the query contains word_separators like slashes
         - thus the path until current word has to be removed after insertion
         - ... and possibly afterwards
     """
     context = Context.get_context(view)
     needle = context.get("needle")
     word = re.escape(Selection.get_word(view))
     self.post_remove = re.sub(word + "$", "", needle)
     verbose(ID, "start tracking", self.post_remove)
Esempio n. 3
0
 def on_post_text_command(self, view, command_name, args):
     current_line = Selection.get_line(view)
     command_trigger = command_name in config["TRIGGER_ACTION"] and self.track_insert["start_line"] != current_line
     if command_trigger or command_name in config["INSERT_ACTION"]:
         self.finish_tracking(view, command_name)
         self.on_post_insert_completion(view, command_name)