I noticed when a view is set to read only via “view.set_read_only(True)”, you can still save the file. I do not think this should be allowed. I understand in most circumstances, a read only file if saved, would just save what was already there, but in my case, this is not true.
I am creating a plugin that converts the current view into hex allowing you to see the raw data. I protect the view by setting it to read only since this is just a viewer, but if a user accidentally hits save it will save the current hex view buffer to the file which is undesirable. This corrupts the file.
Currently I have to save the original buffer when showing hex view and on pre-save, reload the original buffer to make sure the file gets written properly. This works, but I think it should be unnecessary.
If a view is set to read only, I think it should only allow “save as”. It isn’t really read only if it allows you save.