diff --git a/main.py b/main.py index 2b6cdcf..9681296 100644 --- a/main.py +++ b/main.py @@ -181,6 +181,7 @@ class CodempClientViewEventListener(sublime_plugin.ViewEventListener): if self.view == sublime.active_window().active_view(): logger.debug("closing active view") safe_listener_detach(TEXT_LISTENER) # pyright: ignore + try: bid = buffid_from_view(self.view) some(self.view.window()).run_command( diff --git a/plugin/utils.py b/plugin/utils.py index f767ca5..f1dab6c 100644 --- a/plugin/utils.py +++ b/plugin/utils.py @@ -85,6 +85,7 @@ def get_contents(view): def populate_view(view, content): + cursorpos = view.sel()[0] view.run_command( "codemp_replace_text", { @@ -94,6 +95,8 @@ def populate_view(view, content): "change_id": None, }, ) + view.sel().clear() + view.sel().add(cursorpos) def view_from_local_path(path):