Created
April 4, 2020 07:09
-
-
Save jsbain/9edea18951d296ca46aca8868791e04e to your computer and use it in GitHub Desktop.
customMenuItem.py
Perhaps you should also change your code, and I'm sorry but I don't know (or I forgot) how to send you a request to modify
# if selected text contains long unicode characters, erroneous range
# thus we use other way
#txt=str(editorView.textView().text())
#start=editorView.textView().selectedTextRange().start().index()
#end=editorView.textView().selectedTextRange().end().index()
#selected_text=txt[start:end]
tv = editorView.textView()
rge = tv.selectedRange()
start = rge.location
end = start + rge.length
selected_text = str(tv.text().substringWithRange_(rge))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems ok, I'll change my code
Thanks