Community
    • Login

    Double Click Select Copy and Paste in find and replace

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    6 Posts 4 Posters 4.3k 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.
    • James CrawfordJ
      James Crawford
      last edited by

      I use notepad++ all the time more recently as the main editor for PHP development.

      I live everything about this app apart from the double click select.

      If I want to perform multiple ‘find and replace’ on a large array (say simple name change) if the array is

      $arraName['something'];
      $arrayName['somethingElse'];
      

      with hundreds of elements and I decide to change the arrayName to $aryNm Then double clicking $arrayName will only select the text, not the $ sign, but when double clicking in the find and replace box the $ IS selected, similarly if selecting the something element double clicking will select the text only; but if $arrayName[‘something’] was in the ‘find and replace’ text boxes it selects the quotes and square brackets, Is there any way to ensure the same behavior (I don’t care which) is shown in both places?

      Thanks

      Alan KilbornA Claudia FrankC 2 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @James Crawford
        last edited by

        @James-Crawford

        So my first reaction was “who double-click selects something in the ‘find what’ or ‘replace with’ boxes?” I have never ever thought of doing this. But…that’s what I like about discussions like this: maybe you learn something that others do that could be useful to yourself…

        I believe the difference in what is selected in each case is because in the Find dialog edit boxes what happens is “Windows” behavior (sure enough, try it in the filename part of a Save-As dialog), and what happens when you double-click select in a Notepad++ editor window is a “Scintilla” behavior.

        Since you don’t care which behavior you end up with, as long as it is consistent, I think the best path is trying to match what happens when you double click in an editor window to the “Windows” behavior. This could probably be best done with a Pythonscript that runs when a double-click event is detected. The harder part is likely a definite characterization of what happens in the “Find what” in all situations.

        1 Reply Last reply Reply Quote 1
        • Claudia FrankC
          Claudia Frank @James Crawford
          last edited by

          @James-Crawford

          I agree with @Alan-Kilborn, trying to change scintillas behavior would be much easier
          than how the file dialog handles the selection.
          But instead of trying to solve it via the double click event, I would try to solve it by
          modifying what is considered to be a word.
          One of the latest npp version introduced a setting to modify this.
          Settings->Preferences->Delimiter->Word charcater list. Add the dollar sign to it.

          Cheers
          Claudia

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

            @Claudia-Frank

            Would using the Pythonscript editor.setWordChars() function do the same thing?

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

              @Alan-Kilborn

              yes, that is the call which npp calls as well.
              Just keep in mind, that npp does this for every document you open, means
              you may want to call editor.setWordChars() within the BUFFERACTIVATED callback
              to have exactly the same behavior.
              But then, it doesn’t make sense to use the python script way. ;-)

              Cheers
              Claudia

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

                Be careful with what you wish.
                The Scintilla double click selection is tuned for selection which is useful for most developers in most languages. It is extremely useful for quick delete/copy-paste/find/etc.
                The Windows double click selection seems much cruder, respecting mainly slashes.
                Forcing Scintilla logic to match Windows may help the very specific use case that currently annoys you but will break everything else.

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