Community
    • Login

    Cloned file status breaks after N++ restart

    Scheduled Pinned Locked Moved General Discussion
    9 Posts 5 Posters 273 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.
    • Alan KilbornA
      Alan Kilborn
      last edited by

      Try this, in 8.7.9:

      • Press Ctrl+n to create a new tab (new 2 appears, for example)
      • Modify the tab by typing a few random characters
      • Right-click the tab, choose Move Document > Clone to Other View (editing viewport splits and now two tabs are visible with captions of new 2)
      • Type a few more random characters (see that the new typing is appearing in both tabs)
      • Exit and restart Notepad++
      • Type yet more random characters into one of the new 2 tabs (see that the new typing is NOT appearing in both new 2 tabs)

      Does anyone else see this as a bug?
      I’d think that the cloned status of a file should persist over a restart.
      Additionally, in the scenario supplied, the result is two samed-named tabs (normally this is a “not permitted” state) exist concurrently.

      mkupperM Mark OlsonM 2 Replies Last reply Reply Quote 2
      • mkupperM
        mkupper @Alan Kilborn
        last edited by mkupper

        @Alan-Kilborn said in Cloned file status breaks after N++ restart:

        Does anyone else see this as a bug?

        I’d agree that seems like a bug. The backupFilePath values are identical in the <File ...> records in for both the main and secondary views within session.xml. Thus, Notepad++ should be able to detect that it’s a cloned file and to set up the internal linkage so that changes to one of the clones are reflected in the other(s) in real time.

        As they are sharing the same backup file there is some “cloning” in that you can type in one of the tabs, exit/restart Notepad++, and the new material appears in both tabs.

        Another issue is that if you close the former clone/tab (picking No to the save prompt) and then exit Notepad++ then Notepad++ reports

        ---------------------------
        Save
        ---------------------------
        Your backup file cannot be found (deleted from outside).
        Save it otherwise your data will be lost
        Do you want to save file "new 2" ?
        ---------------------------
        Yes   No   Cancel   
        ---------------------------
        

        If you pick Yes then it will want to save this as a normal file.
        If you pick No and then exit/restart Notepad++ then Notepad++ pops up:

        ---------------------------
        File inaccessible
        ---------------------------
        Some files from your past session are inaccessible. They can be opened as empty and read-only documents as placeholders.
        
        Would you like to create those placeholders?
        
        NOTE: Choosing not to create the placeholders or closing them later, your session WILL BE MODIFIED ON EXIT! We suggest you backup your "session.xml" now.
        ---------------------------
        Yes   No   
        ---------------------------
        
        Alan KilbornA 1 Reply Last reply Reply Quote 3
        • Alan KilbornA
          Alan Kilborn @mkupper
          last edited by

          @mkupper said:

          Notepad++ should be able to detect that it’s a cloned file and to set up the internal linkage so that changes to one of the clones are reflected in the other(s) in real time.

          I suppose this could happen, but it seems like it would be simpler for Notepad++ to note the fact of a clone when it writes the session file, and then of course when it reads the session file at next startup it could prepare the cloning state.

          1 Reply Last reply Reply Quote 0
          • CoisesC
            Coises
            last edited by

            I don’t use sessions, nor do I ordinarily have any backup options enabled, but as a test I enabled and tried with a debug compilation. For what it’s worth, the glitch appears to happen here:

            https://github.com/notepad-plus-plus/notepad-plus-plus/blob/a23955742cd4422b2365d6fde7a82b4ff0311bd2/PowerEditor/src/NppIO.cpp#L2536

            Before checking to see if a file to be opened in the secondary view is a duplicate of a file in the first view, the code first checks to see if the file exists. Since “new 1” doesn’t exist, the check isn’t performed.

            1 Reply Last reply Reply Quote 4
            • Mark OlsonM
              Mark Olson @Alan Kilborn
              last edited by

              @Alan-Kilborn said in Cloned file status breaks after N++ restart:

              Does anyone else see this as a bug?

              Not only is this a bug, I’m pretty sure it was a regression. IIRC this bug was fixed a few months ago. No idea why it’s broken again.

              xomxX 1 Reply Last reply Reply Quote 1
              • Alan KilbornA
                Alan Kilborn
                last edited by

                I opened an official bug report on this: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/16412

                1 Reply Last reply Reply Quote 4
                • xomxX
                  xomx @Mark Olson
                  last edited by xomx

                  @Mark-Olson said in Cloned file status breaks after N++ restart:

                  this a bug, I’m pretty sure it was a regression. IIRC this bug was fixed a few months ago.

                  Can you point me to that previous fix, I could not find that?

                  Mark OlsonM 1 Reply Last reply Reply Quote 0
                  • Mark OlsonM
                    Mark Olson @xomx
                    last edited by

                    @xomx
                    As far as I can tell this commit is the most recent fix.

                    xomxX 1 Reply Last reply Reply Quote 1
                    • xomxX
                      xomx @Mark Olson
                      last edited by

                      @Mark-Olson

                      Thanks, I used that info while fixing: x64 Release binary for testing

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