diff --git a/plugin/core/input_handlers.py b/plugin/core/input_handlers.py index a8a76e67e..6281c77e7 100644 --- a/plugin/core/input_handlers.py +++ b/plugin/core/input_handlers.py @@ -117,6 +117,11 @@ def attach_listener(self) -> None: raise RuntimeError('Could not find the Command Palette input field view') self.listener = InputListener(self) self.listener.attach(buffer) + if not hasattr(sublime_plugin.CommandInputHandler, 'initial_selection'): # TODO Replace with ST_VERSION < XXXX + # Workaround for initial_selection not working; see https://github.com/sublimehq/sublime_text/issues/6175 + selection = self.input_view.sel() + selection.clear() + selection.add(len(self.text)) @final def list_items(self) -> List[sublime.ListInputItem]: @@ -141,8 +146,6 @@ def initial_text(self) -> str: sublime.set_timeout(self.attach_listener) return self.text - # This requires a fix for https://github.com/sublimehq/sublime_text/issues/6175 - it can manually be fixed in - # sublime_plugin.py def initial_selection(self) -> List[Tuple[int, int]]: pt = len(self.text) return [(pt, pt)]