TCoolEdit can open read-only text files and by default does not allow editing and saving them.
But the read-only flag can be turned off by the method EnableReadOnlyMode(false), which is available in the Edit->Modes->Read-Only Mode.
If after that the user tries to save the document, the application crashes.
This case should be handled gracefully, by either showing an error message to the user or by clearing the read-only flag of the file and then saving the changes. I think the first option is preferable, as the file may be opened from a read-only location.
Another use case is when the user opens a read-only file and then uses Save As to save it under a different name - the document stays read-only and the user has to manually turn off the read-only flag before editing and saving the changes. The read-only flag should be automatically cleared in this case.
Lastly, it would be nice to have some visual indication when the file that is opened is read-only. For example Notepad++ grays the save icon to the left of the file name, which Visual Studio shows a small lock icon to the right of the file name. Even a simple text "(read-only)" in the title bar may be good to have.
Good ticket!
See also "TCoolEdit: Display ReadOnly in the document title" [feature-requests:#195].
Related
Feature Requests: #195
Possible fixes for the first two issues pushed in [r8820].
Related
Commit: [r8820]
This was easy to fix in "branches/elotter-cooledit" ([r8825]).
However, I think a clean solution should distinguish between a user option and a state flag.
That would mean to introduce a separate read-only state and not to change a user setting.
But I wonder if it wouldn't be simpler not to set the read-only flag when opening a read-only file, but instead to suggest using "Save As" when an attempt is made to save the file.
Related
Commit: [r8825]