Community
    • Login

    Jump back to relevant section after prompted find/replace overshoots?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    11 Posts 4 Posters 4.1k 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

      I’d be interested to hear if others have a solution to this “problem”:

      Say you are doing a prompted Replace operation on many matches that you are needing to change.
      Replace-and-find-next, replace-and-find-next, …
      Ooops, now you have found the first one BEYOND where you need to change (wow, now my caret is way far away in a totally unrelated section of the file).
      It would be nice to easily get back to the last one that you DID change with the replace operation so you can continue working – but how to painlessly achieve this?

      Sure, I could:

      • set a bookmark at each point N++ finds a match that I want to replace
      • block the whole range beforehand (and use the “in selection” option in the replace dialog)
      • mentally note the most recent line number where I Replaced, so that I could Goto the remembered line later

      …but these solutions are “burdensome”.

      Anybody have any other ideas that are maybe better for achieving this? Or am I alone in this bothering me?

      Claudia FrankC 1 Reply Last reply Reply Quote 1
      • Claudia FrankC
        Claudia Frank @Alan Kilborn
        last edited by

        @Alan-Kilborn

        if I understand correctly, than SHIFT+F3.

        Cheers
        Claudia

        Scott SumnerS 1 Reply Last reply Reply Quote 0
        • Scott SumnerS
          Scott Sumner @Claudia Frank
          last edited by

          @Claudia-Frank

          I think the OP meant “replace”, not “find/replace”. because shift+f3 (find previous) works for the “find” case. But if you replace the find text with something else, doing a find-previous moves you to a different place, not where I think the OP is trying to “jump back to” (nearby to the last replacement made). Does this make sense?

          Claudia FrankC 1 Reply Last reply Reply Quote 0
          • gstaviG
            gstavi
            last edited by

            UNDO (Ctrl-Z)
            Then REDO (CTRL-Y) the replace and the caret stays there.

            1 Reply Last reply Reply Quote 4
            • Claudia FrankC
              Claudia Frank @Scott Sumner
              last edited by

              Scott, yes, makes sense to me ;-)

              Cheers
              Claudia

              Scott SumnerS 1 Reply Last reply Reply Quote 0
              • Scott SumnerS
                Scott Sumner @Claudia Frank
                last edited by

                @Claudia-Frank

                Regardless, I see @gstavi has a solution that I didn’t think of – I upvoted! :-)

                Claudia FrankC 1 Reply Last reply Reply Quote 0
                • Claudia FrankC
                  Claudia Frank @Scott Sumner
                  last edited by

                  @Scott-Sumner - me too :-D

                  Cheers
                  Claudia

                  1 Reply Last reply Reply Quote 0
                  • gstaviG
                    gstavi
                    last edited by

                    I always use it to go back to the last place I edited after browsing around the file.

                    1 Reply Last reply Reply Quote 0
                    • Scott SumnerS
                      Scott Sumner
                      last edited by

                      Okay, so this new thing (to me, at least) that I discovered is unrelated, but I think it may fall into the same category of handy tips just like the above-discussed UNDO+REDO thing…and it is sort of similar (do an action, then reverse it).

                      Often I want to make a selection of whole lines with the mouse. More often than not, my code is indented quite a bit, making it uncertain that I am beginning my selection on the correct line when I click and drag on the line numbers in the margin (far away horizontally from the non-whitespace code). Sometimes I miss the correct line and have to start the selection over again. A minor frustration.

                      I found that if I make a selection that includes a PARTIAL first line (convenient because I can start the selection AT my indented code), any number of full lines, and then a PARTIAL last line…then press Tab, then Shift+Tab (this part reminded me of the UNDO+REDO thing)…I get a selection of complete lines which includes the WHOLE first and last lines (remember that these started out as partial lines).

                      Perhaps this technique will be useful to someone else…

                      1 Reply Last reply Reply Quote 2
                      • Claudia FrankC
                        Claudia Frank
                        last edited by

                        Nice trick - indeed.

                        Cheers
                        Claudia

                        1 Reply Last reply Reply Quote 0
                        • Scott SumnerS
                          Scott Sumner
                          last edited by

                          This (PARTIAL lines selection -> Tab -> Shift+Tab -> FULL lines selection) may not be such a great thing after all. After using it in an editing session, and sometimes much later, when doing an unrelated Delete Line operation (via the Delete Line shortcut key, with no selection active), some odd behavior occurs: the wrong line is deleted, I get TWO carets in odd places (I have Multi-Editing enabled)… If I narrow down further what is actually going on, I’ll post here again, but for now: beware of this tip!     : (

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