Community
    • Login

    how do I clear find result window with keystrokes/shortcut

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 4 Posters 2.6k Views 1 Watching
    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.
    • Steve AurelioS Offline
      Steve Aurelio
      last edited by

      I use Find->Find All in Current Document frequently. When I want to clear the results window it is a right click-> Clear all. When using a mouse all day long it would be very helpful to have a command that I can map to a shortcut. I have searched but have not found anything in this area.

      1 Reply Last reply Reply Quote 0
      • cipher-1024C Offline
        cipher-1024
        last edited by

        If the focus is in the results pane, you can just cntrl-a, del. If you need to get the focus on the results pane hit F7. Sadly, since the F7 toggles between the results pane and the editor pane, an F7-select-all-then-delete macro would be a time bomb waiting to go off. Hopefully someone else has a better idea.

        Alan KilbornA 1 Reply Last reply Reply Quote 2
        • Alan KilbornA Offline
          Alan Kilborn @cipher-1024
          last edited by

          @cipher-1024 said:

          an F7-select-all-then-delete macro would be a time bomb waiting to go off.

          Not to mention the fact that macros are really centric around editor operations, not rest-of-program operations. :)

          @Steve-Aurelio said:

          all day long

          Curious why you feel the need to “clear”? A new search “minimizes” previous searches (after which I just tend to ignore them).

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

            I was intrigued by this, mainly for the “can we do this?” potential rather than its usefulness to me… :)

            Thanks to Claudia’s (sniff, sniff) and Scott’s (sniff, sniff) earlier postings on the use of Python’s ctypes module, I was able to come up with this Pythonscript (that can be bound to a single keycombination) to do what the OP has asked for:

            import ctypes
            from ctypes.wintypes import BOOL, HWND, LPARAM
            
            # helpers for ctypes:
            WNDENUMPROC = ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM)
            FindWindow = ctypes.windll.user32.FindWindowW
            GetWindowText = ctypes.windll.user32.GetWindowTextW
            GetWindowTextLength = ctypes.windll.user32.GetWindowTextLengthW
            SendMessage = ctypes.windll.user32.SendMessageW
            EnumChildWindows = ctypes.windll.user32.EnumChildWindows
            GetClassName = ctypes.windll.user32.GetClassNameW
            curr_class = ctypes.create_unicode_buffer(256)
            
            # other helpers:
            WM_COMMAND = 0x111
            NPPM_INTERNAL_SCINTILLAFINFERCLEARALL = 0x400 + 27
            
            find_result_panel_hwnd = None
            
            def foreach_window(hwnd, lParam):
                cc = curr_class[:GetClassName(hwnd, curr_class, 256)]
                if cc == u'#32770':
                    length = GetWindowTextLength(hwnd)
                    if length > 0:
                        buff = ctypes.create_unicode_buffer(length + 1)
                        GetWindowText(hwnd, buff, length + 1)
                        if buff.value == u'Find result':
                            global find_result_panel_hwnd
                            find_result_panel_hwnd = hwnd
                return True
            EnumChildWindows(FindWindow(u'Notepad++', None), WNDENUMPROC(foreach_window), 0)
            
            if find_result_panel_hwnd != None: SendMessage(find_result_panel_hwnd, WM_COMMAND, NPPM_INTERNAL_SCINTILLAFINFERCLEARALL, 0)
            

            Not sure if the OP is inclined to use the Pythonscript plugin to achieve the goal, but that’s neither here nor there to me. :)

            Meta ChuhM 1 Reply Last reply Reply Quote 2
            • Alan KilbornA Offline
              Alan Kilborn
              last edited by

              For the purists out there, stick a return False after the find_result_panel_hwnd = hwnd line and indented to that same level. The purists can also I’m sure find other problems or ways to improve. It works (for me) as above. :)

              1 Reply Last reply Reply Quote 1
              • Meta ChuhM Offline
                Meta Chuh moderator @Alan Kilborn
                last edited by Meta Chuh

                @Alan-Kilborn

                Thanks to Claudia’s (sniff, sniff) and Scott’s (sniff, sniff) earlier postings

                i have avoided to whine about their “temporal” leave lately, especially after a few of your reprehensions about this … and now you remind me again (sniff, sniff) 😉
                at least scott is still around, albeit not active. 👀

                reader’s note: for anyone that wants to try out the code from above, here’s the:
                Guide: How to install the PythonScript plugin on Notepad++ 7.6.3, 7.6.4 and above:

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

                  @Meta-Chuh

                  The sniffling was mainly for your benefit as Claudia and Scott will never see it. :)

                  Your guide is conspicuously missing how to set up PS with a portable N++ >= 7.6.3. Or was this discussed elsewhere?

                  Meta ChuhM 1 Reply Last reply Reply Quote 1
                  • Meta ChuhM Offline
                    Meta Chuh moderator @Alan Kilborn
                    last edited by

                    @Alan-Kilborn

                    The sniffling was mainly for your benefit

                    i thought so, and my first thought was: how thoughtful of you :)

                    as Claudia and Scott will never see it. :)

                    hmmmmmh … sure about that ? what if someone else is claudia in disguise ? 😈🍏🐍

                    Your guide is conspicuously missing how to set up PS with a portable N++ >= 7.6.3. Or was this discussed elsewhere?

                    yes, e.g. here: https://notepad-plus-plus.org/community/topic/17256/guide-how-to-install-the-pythonscript-plugin-on-notepad-7-6-3-7-6-4-and-above/1
                    or here: https://notepad-plus-plus.org/community/topic/16942/pythonscript-any-ready-pyscript-to-replace-one-huge-set-of-regex-phrases-with-others/12

                    but never as a stand alone guide, because apparently portable users usually know how to install it.

                    if it get’s asked again, i, or anybody else, might make a new guide about that.

                    (ps: in other words: i’ve completely forgotten that, while writing the guide … but hushhhhhhhh, dont tell anyone 😉 )

                    1 Reply Last reply Reply Quote 3

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors