Community
    • Login

    With the "replace all" button, replace everything in truth.

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    17 Posts 9 Posters 7.0k 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.
    • Jim DaileyJ
      Jim Dailey
      last edited by

      @Juan-Flavio-Orozco

      Claudia has Wrap around checked, which is the key, I think.

      1 Reply Last reply Reply Quote 0
      • Jason Moss228J
        Jason Moss228
        last edited by

        Guys, just noticed this same thing is being discussed here also. Just posted to it with sample video…

        <<Find and Find>> is great. Why not <<Replace and Replace>> also

        Now if I check “Wrap around” it works as I thought I should, Thanks for the tip!

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

          @Claudia-Frank said:

          Replace works in the direction of your <<find or find>> usage

          Yes, but there’s a problem with this new interface, in my opinion. Before 7.4.2, where I could see UP or DOWN selected, I had great (at least 100%!) confidence that my Replace-All would be in my intended direction. With the 7.4.2 changes to the Find UI, I can no longer be so certain. Notepad++ remembers what I last used for Direction, but I don’t. :-D

          So I find myself putting the caret in a “strategic” spot in relation to the replace I want to do, then doing a Find << or a Find >> to jump to my first desired replacement, THEN doing the Replace-All. It’s “okay”, but it IS sort of an interruption to my desired workflow.

          As previously mentioned, the Wrap option makes direction pointless, but I frequently want to replace from the caret to one end of the file or the other, so I don’t want wrapping enabled.

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

            @Scott-Sumner

            As previously mentioned, the Wrap option makes direction pointless, but I frequently want to replace from the caret to one end of the file or the other, so I don’t want wrapping enabled.

            Scott, I guess I’m missing here something.
            I mean, if you do not want to replace all within the whole document and start searching
            other than from the top, uncheck wrap around, but in case you want to have it but still don’t
            want to switch back to the top, check it. For me it is just another alternative.
            What do I miss?

            Cheers
            Claudia

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

              @Claudia-Frank

              Maybe it is a small point; maybe it just bugs me alone. But to clarify (hopefully), try the following sequence on the text below once you put it in a new editor window:

              • Wrap around: unchecked

              • Put caret at end-of-file.

              • Do a Find << on d twice.

              • …time passes…you do something else…phone rings…your mind is wiped…then you come back to Notepad++…

              • Now you want to change all a from caret point to end-of-file to A.

              • Put a in Find what. Put A in Replace with.

              • Press Replace All…but you have no idea (and no way of knowing) which direction from the caret it will be done (remember, your mind was wiped, by your phone call or whatever). Before the 7.4.2 user interface, you could glance at the Direction box and see if it was set to Up or Down. In this case you will get all the a characters replaced from the caret point to top-of-file, which is NOT what was intended, but since Find << was used more recently than Find >>, that is what you get.

                The
                licenses
                for
                most
                softwAre
                Are
                designed
                to
                take
                away
                your
                freedom
                to
                share
                and
                change
                it.

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

                @Scott-Sumner

                :-) this is clear it was about

                As previously mentioned, the Wrap option makes direction pointless,

                btw. how can I remember that my brain was wiped if it was wiped??
                I mean, my brain hasn’t a function like

                if (nothing_in_brain())
                {
                    brain_has_wiped = True;
                }
                

                my brain has a function like

                if (nothing_in_brain())
                {
                    go_and_take_another_coffee_nothing_to_do_at_the_moment();
                }
                

                :-D

                Cheers
                Claudia

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

                  @Claudia-Frank

                  Could it be that @Scott-Sumner, when saying that “wrap makes direction pointless” is meaning that when Replace-All is being used, in conjunction with the wrap checkbox being checked, it doesn’t matter which direction the search+replace goes, the effect is the same?

                  In this situation, all occurrences of the find text are replaced with the replace text for the entire document (regardless of direction). I can’t think of a scenario where this isn’t true for a normal mode search (and it doesn’t apply to regex searches because they are only in the down direction).

                  Heck, maybe even internally when N++ sees this situation (Replace All in upwards direction), it converts it to Replace All in downwards direction, because code-wise I would think that is simpler to handle (string matching functions work better from a starting point to a point further in the string–think a regex engine and lookaheads–easier than lookbehinds). Okay, okay, that theory about N++ internals may be a bit “out there”. :-)

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

                    @Alan-Kilborn

                    Could it be that @Scott-Sumner, when saying that “wrap makes direction pointless”…

                    I guess so but maybe I misunderstand the meaning of the word pointless here.
                    I would translate it to the german word sinnlos which means it makes no sense.
                    But I can’t argue that a parameter (wrap around) used by a function (replace all) makes
                    direction parameter pointless, can I? I mean, yes, if you use wrap around together with
                    replace all the direction previously used doesn’t matter - everything gets replaced.

                    Now while typing this I start to understand, I think, it means, in this situation, the direction
                    doesn’t matter.

                    Sometimes it just takes a bit longer (only days) to get my brain into gear.

                    Thanks for clarification :-D

                    Cheers
                    Claudia

                    1 Reply Last reply Reply Quote 1
                    • zylstraZ
                      zylstra
                      last edited by

                      I see now that I can use Replace as I would expect it to function if I check the Wrap around option box. But I think the UI is lacking in this instance. The Replace feature should replace all instances by default with nothing checked. From there consider if adding an option for replacing forward or backward is needed.

                      My experience was that I found that Replace replaced only forward from my cursor. I was confused, so I searched the interface for an option to “replace all”, which I did not find. I thought that In selection might have something to do with it; it would work if I selected everything, but it is still kludgy.

                      So I checked Backward direction and clicked Replace All. It worked! I fixed it …Or so I thought …Until I attempted to replace something in another document. This time only the upper portion of the document was replaced. Sooo, I had to uncheck the Backward direction box and click Replace all again.

                      But, I thought, this certainly can’t be the way this was designed to work. So here I find myself …searching the web …and finally just wishing the UI was better designed.

                      PeterJonesP Lycan ThropeL Alan KilbornA 3 Replies Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @zylstra
                        last edited by PeterJones

                        @zylstra ,

                        I see now that I can use Replace as I would expect it to function if I check the Wrap around option box. But I think the UI is lacking in this instance. The Replace feature should replace all instances by default with nothing checked.

                        Out of the box, Notepad++ ships with that checkbox checked (so Wrap Around is enabled by default). Thus, the behavior you want as the default is the default behavior. Complaining because the checkbox was worded in such a way that the default behavior required a checkmark that was already there seems pointless to me.

                        I find myself …searching the web

                        In the future, I suggest you go to the ? menu in Notepad++, which is in the position nearly-universally used for the “Help” menus in Windows programs, which contains useful links like “Notepad++ Online User Manual” which takes you to the online User Manual (which includes the “Searching” page, with a description of how to use the various options on the Find or Replace or similar tabs), or the “Notepad++ Community (Forum)” which would have taken you here without searching.

                        But, I thought, this certainly can’t be the way this was designed to work

                        And in fact, it was designed to work with Wrap Around enabled by default, exactly as you desired. Yay!

                        1 Reply Last reply Reply Quote 1
                        • Lycan ThropeL
                          Lycan Thrope @zylstra
                          last edited by

                          @zylstra ,

                          Besides what Peter has mentioned, I unchecked it because I don’t like the search continuing back around because sometimes changing things changes other things and the second time around might mistake one pattern for another, BUT, I also put my cursor at the beginning of a document so that it can search from top to bottom, and when done, doesn’t wrap around it just says it can’t find any more. That’s what I’m used to, so you may not like going to the top of the document, like I do, in which case, leaving the Wrap Around checked will accomplish what you want after starting in the middle of a document.

                          Alan KilbornA 1 Reply Last reply Reply Quote 0
                          • Alan KilbornA
                            Alan Kilborn @zylstra
                            last edited by Alan Kilborn

                            @zylstra said in With the "replace all" button, replace everything in truth.:

                            But, I thought, this certainly can’t be the way this was designed to work.

                            I think you’re “off base” in most if not all of your statements.

                            wishing the UI was better designed

                            This can be said of any UI ever created. (So you’re accurate in that statement).

                            The Replace feature should replace all instances by default with nothing checked

                            No, that’s what Replace All is for. And even, as you’ve noticed Replace All has qualifiers (aka options).

                            My experience was that I found that Replace replaced only forward from my cursor.

                            Expected behavior in any text editor ever made.

                            so I searched the interface for an option to “replace all”, which I did not find.

                            Really?? It’s right there. A bit fat button that says Replace All on it. (But you do know that because you discuss it later in your post).

                            So I checked Backward direction and clicked Replace All. It worked! I fixed it …Or so I thought …Until I attempted to replace something in another document. This time only the upper portion of the document was replaced.

                            Totally expected behavior. You are telling it to replace upwards.

                            In summary: Really? Is your posting a joke? It’s (the UI) not bad, and it isn’t hard to understand…

                            1 Reply Last reply Reply Quote 0
                            • Alan KilbornA
                              Alan Kilborn @Lycan Thrope
                              last edited by Alan Kilborn

                              @lycan-thrope

                              I unchecked it because I don’t like the search continuing back around because sometimes changing things changes other things and the second time around might mistake…

                              You are notified when the wrap around happens…

                              General thought for this thread: I think 2 very different behaviors (Replace and Replace All) are being discussed as if they are closely related; they, and their options are somewhat different.

                              zylstraZ 1 Reply Last reply Reply Quote 1
                              • zylstraZ
                                zylstra @Alan Kilborn
                                last edited by

                                @alan-kilborn @PeterJones Are either of you UI designers? Or at least designers for this application?

                                Alan KilbornA 1 Reply Last reply Reply Quote 0
                                • Alan KilbornA
                                  Alan Kilborn @zylstra
                                  last edited by Alan Kilborn

                                  @zylstra said in With the "replace all" button, replace everything in truth.:

                                  Are either of you UI designers? Or at least designers for this application?

                                  I’m an old-timer here on this site, so I know where this is going…
                                  It comes up occasionally.
                                  Everyone thinks they have the best idea for how this UI should be designed.
                                  And everyone proposing changes gets shot down, because there is no “best idea”.
                                  So if you want to continue complaining about this UI, go ahead, but I guarantee that it is pointless and no one will care about your complaints.

                                  The answer is to learn how to use the software – it isn’t that difficult. Some of your initial statements show that you have no clue about a traditional text editor’s search and replace functions and the basic workings that have been in place for decades.

                                  Tangentially related: Perhaps you will like (i.e., find amusement in) these issues:

                                  • Find - Replace dialog enhancement and simplification
                                  • Enhancement of the Search and Replace dialog (S&RD) in N++ and related tools: descriptive Help and new Features explained
                                  1 Reply Last reply Reply Quote 5
                                  • First post
                                    Last post
                                  The Community of users of the Notepad++ text editor.
                                  Powered by NodeBB | Contributors