Sublime Forum

What's the safest way to temporarily replace view content?


I want to temporarily replace parts of the visible view content, but also ensure that the original content is put back in place when any key is pressed or if the window or Sublime is closed.

It’s important that the view content is not left modified. For example, if you use an input panel, the content can be replaced if the panel is closed, but if the window or sublime is closed then then the on_done or on_cancel input panel events are not called so the original view content is not replaced.

I was hoping I could use Phantoms, which would be ideal because they don’t modify the actual content, but it’s probably not possible to do without displacing the content.

I’m guessing it’s not going to be easy to do what I want. Do you have any suggestions? Have others tried to do something similar, how did you solve it?