Hi.
I am writing my first plug-in. It’s a contextual plug-in that lets me do stuff with selected words.
So far, this is how it works: I select a word, control-click it to call the contextual menu and then I choose the appropriate action. The code looks something like this:
class ProcessWordCommand(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
if not region.empty():
word = self.view.substr(region)
#then process word
But what I actually need is to simply control-click the word (without selecting it first) and choose the contextual command for it. How can this be achieved? In other words, how can I get the python code to pick up the whole word based on where I clicked in the text?
Thanks a lot in advance.
Psych