Notepad3
Notepad3 copied to clipboard
Behavior of "Change History Margin" with "Revert from File (F5)"
- Load a file and make some changes (saved and/or unsaved).

- Now reload the file:
"Revert from File (F5)"

Question: Is this the desired behavior of the "Change history margin" after a "Revert from file (F5)" π€
Just my humble opinion: no, this is not the desired behaviorβ¦
Reverting should set everything back β after using the Revert from file (F5) option, I'm sitting in front of the unaltered file in its original state. So I think the change markers should be completely reset as well, the file is not modified in any way.
My humble opinion is: The change history display is correct: Reverting (from file (F5)) changes the current session by overriding current document by file content, so showing a change marker for complete document is correct. Proof: pressing Ctrl-Z return to previous state (even if there has been no changes). Reverting from file (F5): Current Notepad3 session does not keep a history of file changes by external tools during the session, so it keeps track of current session changes only. Change history marker is correct here.
Easy use-case:
- Switch OFF "File Change Notification"
- Load any file into NP3.
- Change this file on disk, using another editor.
- Press
Revert from file (F5)
=> Change History Marker tells me: Pressing Ctrl+Z will bring back my previous document, which is different from file content meanwhile.
See first post: Question: Is this the desired behavior of the "Change history margin" after a "Revert from file (F5)" π€
My humble opinion is: The change history display is correct: Reverting (from file (F5)) changes the current session by overriding current document by file content, so showing a change marker for complete document is correct. Proof: pressing Ctrl-Z return to previous state (even if there has been no changes). Reverting from file (F5): Current Notepad3 session does not keep a history of file changes by external tools during the session, so it keeps track of current session changes only. Change history marker is correct here.
Hello @RaiKoHoff ,
Since v5.22.1020.1 beta, after a "Revert from file (F5)", the "Change history green marker is no longer displayed ! π€
Question: Is this a bug or a new behavior of the "Change history margin" after a "Revert from file (F5)" π¬ π€
Corrected, it works as designed. π
replacing SCI_REPLACETARGET calls by SCI_REPLACETARGETMINIMAL
Hello @RaiKoHoff ,
I understand that after a Revert to file (F5) the new SCI_REPLACETARGETMINIMAL keeps the Change history bars on changed lines instead of all lines. π
But this behavior of Revert to file (F5) with an unsaved file seems me strange ? π€


In Scintilla's documentation for the new feature SCI_REPLACETARGETMINIMAL you will find:
This is similar to SCI_REPLACETARGET but tries to minimize change history when the current target text shares a common prefix or suffix with the replacement.
So the common prefix is the text before the first change and the common suffix is the text after the last change. I think this method does not care for details between prefix and suffix for performance reasons.