def full_region(region):
# I'm assuming this region.begin()+1 is why it's selecting xtra characters
return (sublime.Region(region.begin(), region.begin() + 1)
if region.empty() else region)
def perform_transposition(edit, view, trans, init_sel):
" assumes trans is already reverse sorted sequence of regions"
view.sel().subtract(init_sel)
for i, (sel, substr) in enumerate(zip(trans, reversed([view.substr(s) for s in trans]))):
view.replace(edit, sel, substr)
if not i:
if init_sel.empty():
view.sel().add(sublime.Region(init_sel.a + 1))
else:
view.sel().add(init_sel)
# And here should set can_transpose_words=True
def transpose_selections(edit, view, can_transpose_words=False):
for sel in view.sel():
word_sel = view.word(sel)
word_extents = (wb, we) = (word_sel.begin(), word_sel.end())
transpose_words = sel.end() in word_extents
Also I guess it’s a case of copying and pasting into my User folder and then what ? It’s not in the same format as a plugin, so not sure what the next steps are, as I don’t seem to be able to alter the file (read only). Any thoughts ?
Ta