replace function



  • @go2to

    I saw also Claudia’s screenshot on changing fonts in a document. I tried it and never worked for me.

    Can you explain in detail what you did and what you expected that should happen?

    Cheers
    Claudia



  • guy038
    Your procedure works only in the open file, it can’t be applied to several files (especially on disk)! Replace in files is where the action is. I look with anticipation to see the replace box behave exactly like the find box without changes in EOL.

    Don Ho?

    For now, the Parpaluck procedure (\r\n) remains the only one applicable to multiple files directly on disk.



  • Hi, @@go2to,

    I didn’t say that this procedure was “THE” solution. Of course, It’s just an interesting work-around, which may be helpful to some of us, from time to time !

    And I agree, with you, that this multi-lines S/R is rather difficult to run on multiples files, because each of them must be “Unix” files, before performing the S/R, in the Replace in files dialog :-((


    If you long for a true Multi-lines S/R feature, you could add a pull request, at the address, below :

    https://github.com/notepad-plus-plus/notepad-plus-plus/pulls

    But, please, don’t expect a rapid reply to your request !!

    Best Regards,

    guy038



  • thanks all for your answers
    my english is not very good
    i tried the link to add a pull request but it open https://github.com/notepad-plus-plus/notepad-plus-plus/compare so i dont understand what to do…
    i have 2 others questions for s/r
    i have noticed that when i used the s/r function it not begin at the top of the file but where i was looking in the file, it will be great if this function by default could begin by the top of the file
    and an other question
    it will be nice if we could know in which files, which line notepad++ did the job. in dont see how to see that when i use s/r in directories.
    but perhaps its me who dont use well notepad++



  • Before this thread went all crazy-nuts…

    @Claudia-Frank said:

    but now comes my time to shorten your eol conversion.
    Goto Edit->EOL Conversion-> and choose the appropriate one ;-)

    Even shorter is double-clicking the “Windows (CR LF)” area of the status bar (or whatever that area of the status bar currently says for you) and making the “appropriate” choice that appears in the 3-item menu that appears. :-D



  • @go2to

    The intriguing aspect here is the difference in the two boxes. The find box works as-is, with no changes in EOL codes. Don Ho?

    Here’s the difference as I see it:

    When a Find is invoked with a selection active, the selected text is put into the find-what box with this C++ code:

    void FindReplaceDlg::setSearchText(TCHAR * txt2find) {
        ...
        ::SetDlgItemText(_hSelf, IDFINDWHAT, txt2find);
    

    the txt2find data may contain carriage-return (CR) characters; it is no problem for the SetDlgItemText() function to put those into the find-what box’s data.

    On the other hand, there is no corresponding automatic way to get Notepad++ to put data into the replace-with box, so we have to Paste it in with Windows’ normal paste functionality. Controls like the find-what and replace-with box do not accept CR via this Windows paste functionality. Thus multiline data pasted in gets truncated just before the first CR.

    I did a simple test with a new Visual Studio C++/MFC app, dialog-based, with a combobox dropped onto the dialog form. It, too, cannot accept any data pasted in after (and including) a CR.

    The linefeed (LF) character presents no such difficulty to Windows’ normal paste, which we have seen in the experimentation discussed previously in this thread.



  • @Scott
    Still the replace box accepts \r\n in extended mode, which is CR+LF.

    Several other editors accept direct copy and paste in the replace-with box, be it CR+LF, LF or combination of both. They are probably written in C++. But I think it can be done in any language since CR and LF have the same codes.

    Don is busy now with other issues in 7.4.1. I saw there are problems with replacing again in several open files.



  • @go2to

    Still the replace box accepts \r\n

    Do you mean literally \ followed by r followed by \ followed by n? If so then that’s not what I’m talking about just above. However, if you’re saying that you can get the replace-with box to accept more than one line where the line-separator has a definite CR character in it, even in Extended mode, then I’m afraid I can’t duplicate that behavior (all I get is the first line). At the time of paste, it is irrelevant which search-mode is in effect, a paste into the replace-with box is just a paste…

    other editors accept…they are written in C++

    Certainly, but that’s not relevant to the current discussion. Unless the complaint is “Other editors can do it, why not Notepad++?” To that I’d say it is just a limitation, and the C++ code could be changed in the future to remove that limitation.



  • @go2to said:
    Several other editors accept direct copy and paste in the replace-with box, be it CR+LF, LF or combination of both. They are probably written in C++. But I think it can be done in any language since CR and LF have the same codes.\r\n\r\nDon is busy now with other issues in 7.4.1. I saw there are problems with replacing again in several open files.\r\n

    It is now one line after deleting CR+LF and adding \r\n. Everything is pasted in the replace box.
    It works flawlessly in the current file, or all open files, or in find in files.


Log in to reply