The only way I've managed to do so is to go from region > point > layout, offset the layout, and then go back again. It works just fine but it's not very elegant. Here's what it looks like:
- Code: Select all
region_a = list(view.text_to_layout(region.a))
region_b = list(view.text_to_layout(region.b))
region_a = region_a + offset
region_b = region_b + offset
region = sublime.Region(view.layout_to_text(region_a), view.layout_to_text(region_b))
I'm looking for gentle (or not so gentle) suggestions for improvement in either my python or use of the API .