EmEditor (text editor) Forum Index
   EmEditor Core Enhancement Suggestions
     Automatic: Erase Find Highlight
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
CrashNBurn
Posted on: 9/28/2010 3:55 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Automatic: Erase Find Highlight
I updated my AHK fix for this,
1) Automatically Clear the Find Highlight when you Click [Close] on the Find|Replace dialog.
2) Does NOT clear the Find highlight if:
---> you press keyboard {ESC} or
---> click [X] on Titlebar. or
---> Shift+Click, or Ctrl+Click.

#ifWinActive, Find ahk_class #32770, &Search All Open Documents
{
    $LButton::    IWA_32770_FindReplace( "{LButton Down}" )
    $LButton UP:: IWA_32770_FindReplace( "{LButton Up}"   )
return
}
#ifWinActive, Replace ahk_class #32770, Search All &Open Documents
{
    $LButton::    IWA_32770_FindReplace( "{LButton Down}" )
    $LButton UP:: IWA_32770_FindReplace( "{LButton Up}"   )
return
}

WinGetParentClass(winTitle="A", winText="", exTitle="", exText="")
{
    WinGetClass, wClass, % "ahk_id " DllCall( "GetParent", "UInt", WinExist(winTitle, winText, exTitle, exText))
return wClass
}

IWA_32770_FindReplace(mKeyF)
{
    EmEditorMainFrame3_sendKey:="!{F3}", EmEditorMainFrame3_control:="Button16" 
    ControlGetFocus, cgFocus
    Send, % ((wpClass:=WinGetParentClass()) && doKey:=(cgFocus==%wpClass%_control)) ? mKeyF : mKeyF
    if( GetKeyState("Ctrl") || GetKeyState("Shift") )
	return
    Send, % (doKey && (WinGetClass("A")==wpClass) && %wpClass%_sendKey) ? %wpClass%_sendKey : "" 
return
}
Yutaka
Posted on: 8/26/2010 9:53 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2401
Re: Automatic: Erase Find Highlight
Hello Jibz,

I might add that feature in future versions of EmEditor.
Thanks for your comments!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

Jibz
Posted on: 8/26/2010 5:06 am
Just popping in
Joined: 8/26/2010
From:
Posts: 9
Re: Automatic: Erase Find Highlight
I quite like the way Notepad++ does this particular feature. As soon as you select a piece of text that could be an identifier, it will highlight all nearby matches, and when you deselect again the highlight is removed.

It is quite convenient for quickly seeing places a variable is referenced in a source file.
CrashNBurn
Posted on: 8/16/2010 10:39 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Automatic: Erase Find Highlight
Updated Previous post with much cleaner/functional code.
CrashNBurn
Posted on: 7/27/2010 3:33 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Automatic: Erase Find Highlight
I didn't want to disable the Find Highlight.
My request was to to automatically clear the Find Highlight when the Find Dialog was closed -- if a checkbox on the find dialog was checked: [x] Clear Highlights.

I solved it with AutoHotKey. The original AHK solution was Kludgy and didn't work consistently.

Perhaps someone else will find some use for it.
Fixed clean code:
;;
;;  Script: EE_AutoClearFindHighlight.ahk
;;  Author: MwM - Crash&Burn, 2010
;;  Usage:: 
;;    Automatically clear the Find Highlight when EmEditor's
;;    Find Dialog is closed with the [Close] Button.
;;
;;    Does not clear the Find Highlight if ESC, or the 
;;    Find Dialog's TitleBar [X] is used, nor if a modifier
;;    key is held down when clicking [Close] (i.e. Shift)
;;
  #SingleInstance, Force 
  #NoEnv
SetBatchLInes, -1

#ifWinActive, Find ahk_class #32770
{
  ~LButton::
; $ESC::
  {  
    aParent := DllCall( "GetParent", UInt, WinExist("A") )
    aParent := (( !aParent ) ? WinExist("A") : aParent )
    WinGetClass, aClass, ahk_id %aParent% 
    if( aClass <> "EmEditorMainFrame3" )
      return
    if( A_ThisHotKey == "LButton" )
    {
      MouseGetPos, ,, aFind, aControl
      if( aControl <> "Button16" )
        return
      KeyWait, LButton
      Sleep, 50
      ifWinExist, ahk_id %aFind%
        return
      WinWaitActive, ahk_class EmEditorMainFrame3
      Send, !{F3}
    }
    ;; If one wanted the Find Highlight to clear on ESC
    ;; Remove comment block below, and uncomment ESC above.
    /*
     *
    else    
    if( A_ThisHotKey == "$ESC" )        ;;  Not clearing Find Highlight on ESC, atm
    {
      Send, {ESC}
      Sleep, 50
      ifWinExist, ahk_id %aFind%
        return
      WinWaitActive, ahk_class EmEditorMainFrame3
      Send, !{F3}
    }
     *
     */
  return
  }
return
}  
Yutaka
Posted on: 7/27/2010 12:29 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2401
Re: Automatic: Erase Find Highlight
Hi CrashNBurn,

I am sorry. I mean "Search Colors" text box, not "Character Space" in the Display tab of configuration properties.

Thanks!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

CrashNBurn
Posted on: 7/27/2010 8:49 am
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Automatic: Erase Find Highlight
That particular setting [ character space: 0 ] appears to increase the spacing between each character of your current font...

The request was to have a checkbox on the Find-Dialog that can be easily toggled on/off so that when the Find-Dialog is closed the Find Highlights get cleared (when checked) and not cleared (when not checked).

Yutaka
Posted on: 7/26/2010 6:42 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2401
Re: Automatic: Erase Find Highlight
Hi CrashNBurn,

Thanks for your comments! You can also set "0" in the Character Space text box in the Display tab of configuration properties.

Thanks!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

CrashNBurn
Posted on: 7/26/2010 3:04 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Automatic: Erase Find Highlight
The Find Highlight feature is interesting, though I find it annoying more so than helpful in many cases.

I'd like to see an option, if possible, on the Find Dialog:
Quote:
[X] Erase Find Highlight on Close.


Thanks.
Threaded | Oldest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文