how do I clear find result window with keystrokes/shortcut
-
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.
-
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.
-
@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).
-
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. :)
-
For the purists out there, stick a
return Falseafter thefind_result_panel_hwnd = hwndline 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. :) -
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: -
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?
-
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/12but 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 😉 )
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