-
-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Undo should undo file reload/revert #1089
Comments
Development Remarks:
|
Please test (experimental) development beta version _5.19.512.1698_XpErImEnTaL. Known issue: redo an undo crossing file-revert event causes strange selection restore behavior. |
Apart from the modified state issue, this is looking good. |
@AlexVallat : Thank you for testing this feature. I will try to debug the "modified state issue" soon. |
Please test (experimental) development beta version _5.19.514.1702_RC. Toggling "Monitoring Log" will clear Undo/Redo History (to avoid memory leakage on AutoReload). |
Seems to be fixed up well. I think Monitoring Log clearing Undo/Redo history is fine, I can't think of any workflow where Undo/Redo would make sense in that situation. I don't know what sort of monster sized files you typically deal with, but I measured incremental memory usage at about 2x file byte size, which doesn't seem unreasonable to me. Considering the vast majority of text files I deal with are in the <1MB range, it would take a hell of a lot of refreshes before it starts to consume a worrying amount of memory! Log files might be bigger, of course, but that's what the Monitoring Log option is for... |
@AlexVallat : Regarding the open point in your last comment: |
I see. That makes sense, I guess, it would be a pain if you had to code in a check yourself for text equality before deciding to add to the undo stack or not. I don't agree with your example, though: add a character and backspace should be two entries in the undo stack, each one having caused a change! |
A little change to the open point would make a valid optimization request:
This is easy to implement: Just ignoring the revert request 🤔 . |
Please test (experimental) development beta version _5.19.515.1703_RC. |
I'm not sure that's a good idea... Revert is often used to mean reload - even thought the state is not dirty, we know (or suspect) the file content has changed and want to see the new content. Ignoring the revert request would break this use case. |
The |
Possibly. The only case I can think of that might not be covered there is that if FileChangeNotification is Display Message, but the user chooses not to reload in response to the message because they want to check something in the current text first. Then they are happy and want to reload, so hit F5, but the file would not be reloaded because according to the flag, it hasn't changed. Just generally risky to prevent the user from reloading if they've explicitly given the reload command, in my opinion. |
Okay, agreed - will revert the last change - this means, we have to live with the "undo" availability on |
Hello @AlexVallat , |
If the file is modified externally, and you reload or revert in order to pick up the changes (either automatically through the use of the File Change Notification functionality or manually through the Revert command), the change of text should go on the undo buffer.
So, I have a file with content "text". I edit it externally to be "text 2". In Notepad3 I reload the file to pick up the change to "text 2". If I now click Undo, the content should be "text", and the modified state be dirty. Redo would return the text to "text 2", and the modified state to clean.
Visual Studio, for example, uses this behaviour. It's quite useful when you find something has changed the file in a way you didn't want or expect, and you want to get the old contents back again.
The text was updated successfully, but these errors were encountered: