Sublime Forum

[BUG?] view.replace(...) also selects the inserted text

#1

Env: ST 3109 Portable Win x64

class MyTestCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        insertPos = 0 # just an arbitrary non-negative integer
        self.view.replace(edit, sublime.Region(insertPos, insertPos), 'TEXT')

The above command would insert TEXT at point 0.
However, if your cursor is also at point 0 while executing this command, after the execution, TEXT is selected.


To test, I just run view.run_command('my_test') in the ST console.

0 Likes