Menu

Lost bookmarks on file reload

2007-12-14
2012-11-13
  • Nobody/Anonymous

      Hi,
    I use Notepad++ version 4.6 and have the following problem:
        - Open some text file in Notepad++ and place some bookmarks
        - Open the same file in some other text editor, modify it and save it
        - Notepad++ asks me if I want to reload a file
        - I reload the file and my previously placed bookmarks are gone
    Is this an intended feature or a bug? I would like to keep my bookmarks on file reloads if at all possible :)

      Thanks in advance,
        Zoran

     
    • Nobody/Anonymous

      Another way around this problem depends on why you bookmarked them.  If you bookmarked lines containing a particular string, then using the Mark Line option in Find could quickly mark them again.  If they're just random locations you want to keep referring to, then Clone to Another View would be helpful, but it reverts both views back to line 1.  Surely it would be relatively easy to get them both to stay at the same line number.

       
    • fidvo

      fidvo - 2007-12-14

      It sounds to me that it would be impossible to implement this feature, simply because you would have to anticipate what happened to the file in the other editor.  Let me provide a couple of examples to explain why it wouldn't work:

      1) The easiest way to code this would be to keep the bookmarks on the same line as before.  But if you add a line to the beginning of the file in the other editor, now all of your bookmarks are off by a line, so you might as well start over anyway.

      2) The other way to code this would be to try to match each bookmark based upon the text of the lines they were on before.  However, if in the other editor you ran a process that modified every line, you've lost your bookmarks again.

      3) However you code it, what if in the other editor you deleted the entire document and pasted in an entirely new document?

      The only way it would work is if the bookmarks were saved right in the file itself, but then it would require a special file format, which defeats the purpose of Notepad++.

      Of course, I could be wrong, and maybe there's already a setting that does this.  Anyone who knows more than I do, please feel free to contradict me.

       
      • Jurko Gospodnetić

          Hi.

          Actually solution 1) seems preferable to the current one. YMMV but that way, in cases I encounter most often in practice, bookmarks would remain in or close-enough to the correct position.

          My main use cases where this is a real PITA would be:

          1. log files which get appended to by an external process.
          2. source files updated from a source control system which usually, with updates not being too far apart, get only a small percentage of their content changed/added/removed.

          Current solution makes bookmarks never useful under such circumstances.

          I believe UltraEdit bookmarks function this way and I found them really pleasant to use.

          Hope this helps.

          Best regards,
            Jurko Gospodnetić

         
        • Nobody/Anonymous

          This seems the best way to easily improve the functionality.

          Of course the document could be completely different after the external change, but at least you get to keep some "information" about it. Scanning the bookmarks will give you a quick impression of what, where or how much was changed. I assume you know "where" you set your bookmarks, as they aren't read from the file itself.

          Next to that, you can always use the Compare Plug-In to check the external file against the internal document, to see all the changes.

          I guess the original requester would smile if solution 1 was implemented.
          Be careful, though, not to set bookmarks (back) on lines that don't exist anymore.