Community
    • 登入

    Double Click Select Copy and Paste in find and replace

    已排程 已置頂 已鎖定 已移動 Notepad++ & Plugin Development
    6 貼文 4 Posters 4.6k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • James CrawfordJ
      James Crawford
      最後由 編輯

      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 條回覆 最後回覆 回覆 引用 0
      • Alan KilbornA
        Alan Kilborn @James Crawford
        最後由 編輯

        @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 條回覆 最後回覆 回覆 引用 1
        • Claudia FrankC
          Claudia Frank @James Crawford
          最後由 編輯

          @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 條回覆 最後回覆 回覆 引用 0
          • Alan KilbornA
            Alan Kilborn @Claudia Frank
            最後由 編輯

            @Claudia-Frank

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

            Claudia FrankC 1 條回覆 最後回覆 回覆 引用 0
            • Claudia FrankC
              Claudia Frank @Alan Kilborn
              最後由 編輯

              @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 條回覆 最後回覆 回覆 引用 0
              • gstaviG
                gstavi
                最後由 編輯

                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 條回覆 最後回覆 回覆 引用 0
                • 第一個貼文
                  最後的貼文
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors