Open ArkadiuszMichalski opened 4 years ago
Confirmed. Seems to be a side effect, at least SCI_EMPTYUNDOBUFFER is not called. The Undo/Redo state is available on switching on hex view, but get lost on switching it off.
Also a modified file in normal mode can't be saved any more after switching hex view on and off. Seems somewhere the file status is modified wrong.
Thanks for the hint, see https://github.com/notepad-plus-plus/notepad-plus-plus/blob/783798e1ab5f063911f6863155380d8a7599f89a/PowerEditor/src/NppBigSwitch.cpp#L1041 and https://github.com/notepad-plus-plus/notepad-plus-plus/blob/783798e1ab5f063911f6863155380d8a7599f89a/PowerEditor/src/NppBigSwitch.cpp#L1077
NPPM_ENCODESCI, NPPM_DECODESCI are clearing the undo buffer implicitly.
The undo history is inconsistent for hex/normal mode. It must be cleared unless the codepage for normal npp is always ASCII. The only thing I can do is delay the clearing time : Instead of clearing the undo history immediately on toggling hex mode, I managed to do so only when the buffer is edited in the other mode. But that requires the modification of npp itself.
Might be related, but I noticed when in Hex mode, Ctrl+Z/Alt+Backspace to undo don't work, but Edit
>> Undo
works. I saw some people complaining on StackOverflow that the Hex editor plugin removes history
When we turn on
View in HEX
mode and off this mode then we lost all file's editing history (Undo/Redo not work). Is this intentional behavior?