Community
    • Login

    How find in selection by key alt? Hello.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    10 Posts 4 Posters 509 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.
    • qweQ
      qwe
      last edited by

      Without alt find in selection working, per what thank.

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

        @qwe

        It is unclear what you are asking.

        But, maybe you are asking if it is possible to find in a rectangular block selection?

        If so, then no it is not currently possible to do that.

        qweQ 1 Reply Last reply Reply Quote 0
        • qweQ
          qwe @Alan Kilborn
          last edited by qwe

          In selection.jpg
          What problem not possibility? If this possibility will appear, then how soon?

          Terry RT PeterJonesP 3 Replies Last reply Reply Quote 0
          • Terry RT
            Terry R @qwe
            last edited by

            @qwe said in How find in selection by key alt? Hello.:

            What problem not possibility? If this possibility will appear, then how soon?

            That option will light up when you have a number of characters pre-selected in the tab you are working on. See the online manual reference here.

            Terry

            1 Reply Last reply Reply Quote 0
            • Terry RT
              Terry R @qwe
              last edited by Terry R

              @qwe

              As an example of pre-selection we have:

              1. no selection of text and the option is “dimmed” as you saw.

              dimmed.JPG

              1. pre-selection of text and the option is “available”.

              lit-up.JPG

              Additionally, if you pre-select more than 1024 characters the option will also be ticked, see the online manual a page down from my previous manual link.

              selection.JPG

              Terry

              1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @qwe
                last edited by PeterJones

                @qwe said in How find in selection by key alt? Hello.:

                What problem not possibility? If this possibility will appear, then how soon?

                As @Alan-Kilborn said, if you have a block selection (the rectangle made while selecting with Alt key depressed), then that option is not available.

                selection type screenshot details
                normal 68d26019-bdd9-4633-94f4-e546cabbdf6c-image.png Can do “in selection”
                rectangle (alt) 5054f78b-2b40-4abb-866d-717fb2ff54aa-image.png Cannot do “in selection”

                What problem not possibility?

                The search-and-replace engine assumes a continuous block of text for its algorithms to work. When you do a column-mode / rectangle / Alt+ selection, interally, it includes multiple equal-width non-continuous blocks of text, and the regex engine cannot handle that. Notepad++ uses an industry-standard search-and-replace library (Boost’s regex engine), and the Notepad++ authors will not be writing their own engine just to handle the rectangular-selection outlier condition.

                workaround / solution

                If you really need to search+replace in just the contents of a rectangular block, I suggest a multistep solution

                1. In your original file, do your rectangular selection
                2. Copy that text
                3. Create a temporary file
                4. Paste into that file
                  2018d350-f3b7-4ed2-88db-c5cb69dbd2fb-image.png
                5. Do your search/replace: make sure that you don’t change the size of the rectangle in that replacement
                  e7477a5d-8f30-4d31-888b-2bf00f6cc6bc-image.png => 97f8ba15-4e9d-4d76-9b35-9151e14630c5-image.png
                6. Column-Select the rectangle from the temporary file and copy
                  fef78a0c-9768-4d38-af91-f7c4b80d4f05-image.png
                7. Return to the original. If you clicked on the tab titles rather than in the tab editor, the original rectangle selection will still exist
                  5054f78b-2b40-4abb-866d-717fb2ff54aa-image.png
                8. Paste overtop the rectangle:
                  51d4ec9b-291b-481a-aba2-fbfe97613dfc-image.png
                Alan KilbornA 1 Reply Last reply Reply Quote 2
                • Alan KilbornA
                  Alan Kilborn @PeterJones
                  last edited by

                  @PeterJones said in How find in selection by key alt? Hello.:

                  Notepad++ uses an industry-standard search-and-replace library (Boost’s regex engine), and the Notepad++ authors will not be writing their own engine just to handle the rectangular-selection outlier condition.

                  There’s nothing that I saw in the OP’s question about regular expressions.
                  That being said, even if it were regex related, there’s nothing stopping Notepad++ authors from allowing search/replace to act on a rectangular block – only an unwillingness to thus far write that code (of course lack of time could be a factor as well).

                  If we are talking about replacement, and not simply find, then I have a scripted solution for “replace all in selections” which will work for a rectangular block. Unfortunately the script doesn’t work for searching, because there is no easy scripting interface to the Search results window.

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

                    @Alan-Kilborn said in How find in selection by key alt? Hello.:

                    If we are talking about replacement, and not simply find, then I have a scripted solution for “replace all in selections” which will work for a rectangular block.

                    I neglected to provide the link to the script in case there is interest. HERE it is.

                    PeterJonesP 1 Reply Last reply Reply Quote 1
                    • PeterJonesP
                      PeterJones @Alan Kilborn
                      last edited by

                      @Alan-Kilborn ,

                      You are correct, there wasn’t anything specific to regex there, and I convoluted search/replace and regex in my mind when invoking the mention of the boost library.

                      If it were to be implemented so that each “row” of the search/replace were done separately, then it wouldn’t be difficult to implement, and it wouldn’t matter if it were normal, extended, or regex search. But trying to search across multiple rows in the rectangle would present a lot of technical challenges – I can think of a few immediately, and I’m sure implementing it would find a lot more. (And whatever decisions are made on those challenges would provoke some vocal percentage of the users of that feature to complain that it was the wrong implementation, and they would all be right but annoying.)

                      But I had forgotten about your scripting solution, so thanks for bringing that up.

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

                        @PeterJones said in How find in selection by key alt? Hello.:

                        But trying to search across multiple rows in the rectangle

                        I would think that anything the developers implemented for rectangular selection searching/replacing could have the caveat that each row (the selected part) is independent and you can’t search across rows with it.

                        And that’s what my replace-all script assumes as well.

                        IMO, that kind of thing (the possibility to search/replace across rows defined by the rectangular selection), is NOT what has prevented the developers from adding the feature to date.

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