From b28ebab294fb13f1bb5cd36ab9774a6dcf50a004 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 9 Nov 2008 18:36:50 +0300 Subject: [PATCH 1/3] 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 Signed-off-by: Shawn O. Pearce --- lib/blame.tcl | 16 ++++++++++++---- lib/search.tcl | 14 +++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/blame.tcl b/lib/blame.tcl index 765d08c004..642f5cab86 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -321,7 +321,7 @@ constructor new {i_commit i_path i_jump} { tk_popup $w.ctxm %X %Y " bind $i "[list focus $w_cviewer];break" - bind $i "[list focus $w_cviewer];break" + bind $i "[cb _focus_search $w_cviewer];break" } foreach i [concat $w_columns $w_cviewer] { @@ -337,10 +337,10 @@ constructor new {i_commit i_path i_jump} { bind $i {catch {%W yview scroll 1 pages};break} } - bind $w_cviewer "[list focus $w_file];break" + bind $w_cviewer "[cb _focus_search $w_file];break" bind $w_cviewer "[list focus $w_file];break" - bind $w_cviewer [list focus $w_cviewer] - bind $w_file [list focus $w_file] + bind $w_cviewer [list focus $w_cviewer] + bind $w_file [cb _focus_search $w_file] bind $top [list searchbar::show $finder] bind $top [list searchbar::hide $finder] bind $top [list searchbar::find_next $finder] @@ -382,6 +382,14 @@ constructor new {i_commit i_path i_jump} { _load $this $i_jump } +method _focus_search {win} { + if {[searchbar::visible $finder]} { + focus [searchbar::editor $finder] + } else { + focus $win + } +} + method _handle_destroy {win} { if {$win eq $w} { _kill $this 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 From e29c0d10a201a4ce0c71ddb65faadff533ed2a98 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 9 Nov 2008 18:51:16 +0300 Subject: [PATCH 2/3] git-gui: Add the Show SSH Key item to the clone dialog. The user might need to see the key before cloning a repository. This patch makes the relevant menu item available in the Select Repository/Clone dialog. Signed-off-by: Alexander Gavrilov Signed-off-by: Shawn O. Pearce --- git-gui.sh | 20 +++++++++++--------- lib/choose_repository.tcl | 6 ++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 12b496bec9..cf9ef6ee07 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -997,6 +997,17 @@ citool { } } +###################################################################### +## +## execution environment + +set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}] + +# Suggest our implementation of askpass, if none is set +if {![info exists env(SSH_ASKPASS)]} { + set env(SSH_ASKPASS) [gitexec git-gui--askpass] +} + ###################################################################### ## ## repository setup @@ -1073,15 +1084,6 @@ set selected_commit_type new set nullid "0000000000000000000000000000000000000000" set nullid2 "0000000000000000000000000000000000000001" -set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}] - -###################################################################### - -# Suggest our implementation of askpass, if none is set -if {![info exists env(SSH_ASKPASS)]} { - set env(SSH_ASKPASS) [gitexec git-gui--askpass] -} - ###################################################################### ## ## task management diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index 909131689e..f9ff62a3b2 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -43,12 +43,18 @@ constructor pick {} { $w.mbar.apple add command \ -label [mc "About %s" [appname]] \ -command do_about + $w.mbar.apple add command \ + -label [mc "Show SSH Key"] \ + -command do_ssh_key } else { $w.mbar add cascade -label [mc Help] -menu $w.mbar.help menu $w.mbar.help $w.mbar.help add command \ -label [mc "About %s" [appname]] \ -command do_about + $w.mbar.help add command \ + -label [mc "Show SSH Key"] \ + -command do_ssh_key } wm protocol $top WM_DELETE_WINDOW exit From f75c8b319f5b448d8e7dc589ca581eec852a131e Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 9 Nov 2008 18:53:09 +0300 Subject: [PATCH 3/3] git-gui: Request blame metadata in utf-8. The blame builtin now supports automatic conversion of metadata encoding. By default it is converted to the character set specified by i18n.logoutputencoding. Since gui blame expects the data in utf-8, it is necessary to specify the desired encoding directly. An old version of the blame command will simply ignore the option. Signed-off-by: Alexander Gavrilov Signed-off-by: Shawn O. Pearce --- lib/blame.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blame.tcl b/lib/blame.tcl index 642f5cab86..c1cd7f3b92 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -559,7 +559,7 @@ method _read_file {fd jump} { } ifdeleted { catch {close $fd} } method _exec_blame {cur_w cur_d options cur_s} { - lappend options --incremental + lappend options --incremental --encoding=utf-8 if {$commit eq {}} { lappend options --contents $path } else {