Hi,
I’m writing a plugin to automatically search open files with the alt+clicked word.
Current code:
import sublime, sublime_plugin
class QuickSearchCommand(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
if region.empty():
line = self.view.word(region)
self.view.insert(edit, line.begin(), self.view.substr(line))
else:
self.view.insert(edit, region.begin(), self.view.substr(region))
This code grabs the word where the cursor was before the click, not the word you just clicked on. How would I move the cursor to the clicked word?