summaryrefslogtreecommitdiff
path: root/lib/search.tcl
diff options
context:
space:
mode:
authorLibravatar Alexander Gavrilov <angavrilov@gmail.com>2008-11-09 18:36:50 +0300
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2008-11-11 09:29:36 -0800
commitb28ebab294fb13f1bb5cd36ab9774a6dcf50a004 (patch)
tree527b10bce80791841a45a63d2896abef2b775615 /lib/search.tcl
parentgit-gui: Update German translation. (diff)
downloadtgif-b28ebab294fb13f1bb5cd36ab9774a6dcf50a004.tar.xz
git-gui: Fix focus transition in the blame viewer.
Now that the blame viewer has a search panel, it should be taken into account by the focus transition code. Otherwise showing a commit tip (by accidentally moving the mouse to the text frame) causes the focus to transfer away from the search field. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/search.tcl')
-rw-r--r--lib/search.tcl14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/search.tcl b/lib/search.tcl
index d292f20f66..32c8656fc9 100644
--- a/lib/search.tcl
+++ b/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
@@ -40,19 +40,27 @@ constructor new {i_w i_text args} {
}
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