Is there undo history limit?
Is there a limit on how many undo history NPP can store?
Presumably, it is at least limited by the available memory on the system.
To experiment, I just did 8192 distinct line-delete operations (created a document 8192 lines long by
Ctrl+A,Ctrl+Drepeated times, then held down the delete-line keystroke until it was all gone again), then ran more than 8192 undos (holding down
Ctrl+Z, after verifying that a single Undo undid the deletion of just one line), and confirmed that it was able to undo more than 8k individual actions – So, practically speaking, there is no hardcoded undo limit before at least >8k actions.
From a theoretical perspective, I haven’t delved into the NPP/Scintilla code to find if there’s a hardcoded limit, but since it made it to 8k operations (which requries 13bits), then there is likely at least 16 bits (64k) of actions avalable to the list (since that would be a 2byte short integer to hold the undo-list index). I didn’t feeling like taking 8x as long to test if it went above 64k. But practically speaking, I cannot imagine that one would need more than 64k undos.
But when you save files, or exit/reload Notepad++, the undo history is reset. So file-save, reload, or memory are more likely limits to hit than a specific count of actions it can undo.
Hopefully, that’s enough for your needs.
Thank you for this.
I’ve been testing NPP and Sublime in parallel, to see which one I like more (jumping ship from UEStudio, mainly because of the undo corrupting files) and encounter undo limit, wasn’t sure which one was it…