Community
    • Login

    Is there undo history limit?

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 1.2k 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.
    • vanowmV
      vanowm
      last edited by

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

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @vanowm
        last edited by

        @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
        • vanowmV
          vanowm
          last edited by

          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
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors