X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-gui%2Flib%2Fsearch.tcl;h=b371e9a30a00fda0ced979c03a1a5d7856654baa;hb=bf0fe35c938ac9f03d1369600b0c76e428a57507;hp=d292f20f66a6319c34c3b38e28ebc120e7dd8400;hpb=275ee50c819d6c25a303f3d01689aba00840a783;p=git.git diff --git a/git-gui/lib/search.tcl b/git-gui/lib/search.tcl index d292f20f6..b371e9a30 100644 --- a/git-gui/lib/search.tcl +++ b/git-gui/lib/search.tcl @@ -19,11 +19,11 @@ constructor new {i_w i_text args} { frame $w label $w.l -text [mc Find:] + entry $w.ent -textvariable ${__this}::searchstring -background lightgreen button $w.bn -text [mc Next] -command [cb find_next] button $w.bp -text [mc Prev] -command [cb find_prev] checkbutton $w.cs -text [mc Case-Sensitive] \ -variable ${__this}::casesensitive -command [cb _incrsearch] - entry $w.ent -textvariable ${__this}::searchstring -background lightgreen pack $w.l -side left pack $w.cs -side right pack $w.bp -side right @@ -35,24 +35,32 @@ constructor new {i_w i_text args} { trace add variable searchstring write [cb _incrsearch_cb] - bind $w [cb delete_this] + bind $w [list delete_this $this] return $this } method show {} { - if {![winfo ismapped $w]} { + if {![visible $this]} { grid $w } focus -force $w.ent } method hide {} { - if {[winfo ismapped $w]} { + if {[visible $this]} { focus $ctext grid remove $w } } +method visible {} { + return [winfo ismapped $w] +} + +method editor {} { + return $w.ent +} + method _get_new_anchor {} { # use start of selection if it is visible, # or the bounds of the visible area