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



  • In version 7.4.2 (that I just downloaded), in the dialog box "replace" does not appear in which direction, up or down (as the previus versions).

    If you find yourself in any part of the document and perform a "replace all" only replaced what is below the point where you are, not what is above this point.

    If I want to replace something, I want that replace it in the whole document or in one selected portion. I suggest implementing this as a fix.



  • @Juan-Flavio-Orozco

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

    Concerning replace all, I tried to understand what you did but wasn’t unable to reproduce.
    My test (first screenshot is just to see how much instances are found)

    I created a file containing 11 instances of the word test.
    Place cursor to line 16, made sure that Wrap around has been checked
    and pressed replace all.
    Worked.

    Maybe something is specific to your setup?
    Can you post the debug info?

    Cheers
    Claudia



  • @Juan-Flavio-Orozco

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



  • 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!



  • @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.



  • @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



  • @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.



  • @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



  • @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”. :-)



  • @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


Log in to reply