I think a solution for the common use-case of `begin_edit` would be helpful. `begin_edit` is still really helpful is when using an input panel (async edits). In the example below I'm doing something trivial (and `run_command('insert')` works), but in the plugin I'm porting now I'm manipulating regions and replacing lots of text... non-trivial. My work around is to create a new command, and pass it all the parameters it needs via `run_command`. This is not good clean code, and it's def not an improvement from `try: begin_edit ...finally: end_edit`.
Would this, or something like it, be possible?
- Code: Select all
# i don't want to create a new command, so instead...
region = sublime.Region(a, b)
text = 'gonna insert it'
self.view.replace(edit, region, text)