View in HEX mode permanently remove file's editing 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?
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.
caused by thie line:
https://github.com/chcg/NPP_HexEdit/blob/e36f71fc9d30ec238a1989ae7b486e4282a83a2d/HexEditor/src/HEXDialog.cpp#L937
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