API: write protected (read-only) regions

Daniel Mescheder 8 ár síðan 0
For plugin development it would be handy to have something like write protected regions.
i.e. in addition to view.set_read_only(value) provide something like view.set_region_read_only(region).
Possible use cases:
  • I think it would be a nice feature for SublimeREPL to protect everything but the current input.
  • Currently it is all to easy to accidentally delete folded regions - with read-only-regions it would be possible to (optionally) protect folds.
Probably I could work around this missing feature using on_selection_modified to find out where the cursor is and set_read_only to protect the buffer accordingly.
However, that seems terribly inefficient to me as I would like to avoid the on_selection_modified roundtrip.