• Login
Community
  • Login

Is is possible to use 'Find and Replace' without the window position changing?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
search windowsearchsearch feature
6 Posts 3 Posters 1.4k 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.
  • E
    Enzonia
    last edited by Enzonia May 23, 2018, 9:46 AM May 23, 2018, 9:45 AM

    Hi, this is more a minor annoyance then anything else. When I use the replace tool, after replacing, the window position jumps down to the next instance of the string. This is useful sometimes, but when I just want to replace a few cases, it just leads to me having to scroll back to where I was before.

    Images to demonstrate what I mean - https://imgur.com/a/QDaezs0

    C S 2 Replies Last reply May 23, 2018, 11:29 AM Reply Quote 1
    • C
      Claudia Frank @Enzonia
      last edited by May 23, 2018, 11:29 AM

      @Enzonia

      what about bookmarking the line (CTRL+F2)prior to the replace action?
      And wants finished you could use F2 to jump to the bookmark.
      But this, of course, works only if this is the one and only bookmark in the document.

      Cheers
      Claudia

      1 Reply Last reply Reply Quote 1
      • S
        Scott Sumner @Enzonia
        last edited by May 23, 2018, 12:13 PM

        @Enzonia

        There’s a “trick” solution for this. It has been mentioned before in this forum. Here it is:

        Use the Replace button as you have been. When you realize you’ve gone too far, press UNDO (default: ctrl+z or ctrl+bksp) followed immediately by REDO (default: ctrl+shift+z or ctrl+y). This will undo your most recent (desired) replacement, then fix it up again (because you want that) with the redo. Meanwhile (…here comes the awesome part…) the caret is now at the location of that final desired replacement and not somewhere distant in the file where you don’t want to be!

        C 1 Reply Last reply May 23, 2018, 12:40 PM Reply Quote 1
        • C
          Claudia Frank @Scott Sumner
          last edited by May 23, 2018, 12:40 PM

          @Scott-Sumner

          Does this still work for you?
          I know the trick but, for me, one of the recent versions seems to have fixed this
          behavior - seems the undo buffer contains every single replace now - at least on linux.

          Cheers
          Claudia

          S 1 Reply Last reply May 23, 2018, 1:04 PM Reply Quote 0
          • S
            Scott Sumner @Claudia Frank
            last edited by May 23, 2018, 1:04 PM

            @Claudia-Frank

            Works for me with 7.5.6, here I show a downward replacement of several occurrences of one with two, the final occurrence being “way down” in the file (we don’t want to change that one)…and we want the caret to end up at the last one we did change (line 7):

            Imgur

            Recording it showed me that I missed part of the description on how to do it; add: “Once you realize you’ve jumped the caret too far using the Replace button, switch input focus back to the editor tab window before trying to invoke Undo”. Kind of obvious, but…

            That is, of course, if this hack works at all…that is a bummer that it is not working in certain situations. And, @Claudia-Frank , tossing around a word like fixed regarding this…tsk, tsk…I would call this a breakage ! :-D I would expect an Undo would only work the way you describe if Replace All was used, not Replace.

            C 1 Reply Last reply May 23, 2018, 1:18 PM Reply Quote 2
            • C
              Claudia Frank @Scott Sumner
              last edited by May 23, 2018, 1:18 PM

              @Scott-Sumner

              sorry - seems I totally misunderstood what OP was asking for.
              I thought OP wants to jump back to the original (starting) position,
              not to the last position which was ok to be replaced. And now I’m thinking that
              this jump (to where the action started) wasn’t possible before at all.

              Cheers
              Claudia

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