• Login
Community
  • Login

Is there undo history limit?

Scheduled Pinned Locked Moved General Discussion
3 Posts 2 Posters 1.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V
    vanowm
    last edited by Oct 3, 2021, 3:01 PM

    Is there a limit on how many undo history NPP can store?

    P 1 Reply Last reply Oct 3, 2021, 5:37 PM Reply Quote 0
    • P
      PeterJones @vanowm
      last edited by Oct 3, 2021, 5:37 PM

      @vanowm ,

      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+D repeated 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.

      1 Reply Last reply Reply Quote 4
      • V
        vanowm
        last edited by Oct 4, 2021, 12:39 AM

        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…

        1 Reply Last reply Reply Quote 0
        2 out of 3
        • First post
          2/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors