From 94a2eede68f2d3cacef489044f5b822f45f2a10d Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Sun, 7 Aug 2005 15:27:57 +1000 Subject: [PATCH 1/3] Change cursor to a hand cursor when over a SHA1 ID link. This is based on suggestions by Jeff Epler and Linus Torvalds, but extended so that we do the switching between the watch cursor and the normal cursor correctly as well. Also fixed a bug pointed out by Junio Hamano - I wasn't incrementing the link number (duh!). --- gitk | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/gitk b/gitk index 59cdd853e2..b38d7cd0ed 100755 --- a/gitk +++ b/gitk @@ -54,7 +54,7 @@ proc getcommits {rargs} { $canv create text 3 3 -anchor nw -text "Reading commits..." \ -font $mainfont -tags textitems . config -cursor watch - $ctext config -cursor watch + settextcursor watch } proc getcommitlines {commfd} { @@ -277,7 +277,7 @@ proc makewindow {} { global canv canv2 canv3 linespc charspc ctext cflist textfont global findtype findtypemenu findloc findstring fstring geometry global entries sha1entry sha1string sha1but - global maincursor textcursor + global maincursor textcursor curtextcursor global rowctxmenu gaudydiff mergemax menu .bar @@ -465,6 +465,7 @@ proc makewindow {} { set maincursor [. cget -cursor] set textcursor [$ctext cget -cursor] + set curtextcursor $textcursor set rowctxmenu .rowctxmenu menu $rowctxmenu -tearoff 0 @@ -1142,7 +1143,18 @@ proc finishcommits {} { drawrest $level [llength $startcommits] } . config -cursor $maincursor - $ctext config -cursor $textcursor + settextcursor $textcursor +} + +# Don't change the text pane cursor if it is currently the hand cursor, +# showing that we are over a sha1 ID link. +proc settextcursor {c} { + global ctext curtextcursor + + if {[$ctext cget -cursor] == $curtextcursor} { + $ctext config -cursor $c + } + set curtextcursor $c } proc drawgraph {} { @@ -1377,7 +1389,7 @@ proc stopfindproc {{done 0}} { unset findinprogress if {$phase != "incrdraw"} { . config -cursor $maincursor - $ctext config -cursor $textcursor + settextcursor $textcursor } } } @@ -1420,7 +1432,7 @@ proc findpatches {} { fileevent $f readable readfindproc set finddidsel 0 . config -cursor watch - $ctext config -cursor watch + settextcursor watch set findinprogress 1 } @@ -1525,7 +1537,7 @@ proc findfiles {} { set id $lineid($l) set p [lindex $parents($id) 0] . config -cursor watch - $ctext config -cursor watch + settextcursor watch set findinprogress 1 findcont [list $id $p] update @@ -1802,10 +1814,14 @@ proc selectline {l isnew} { set linkid [string range $comment $s $e] if {![info exists idline($linkid)]} continue incr e - $ctext tag conf link$i -foreground blue -underline 1 + $ctext tag add link "$commentstart + $s c" "$commentstart + $e c" $ctext tag add link$i "$commentstart + $s c" "$commentstart + $e c" $ctext tag bind link$i <1> [list selectline $idline($linkid) 1] + incr i } + $ctext tag conf link -foreground blue -underline 1 + $ctext tag bind link { %W configure -cursor hand2 } + $ctext tag bind link { %W configure -cursor $curtextcursor } $ctext tag delete Comments $ctext tag remove found 1.0 end From d6e8149bc53de57cab7cc0d9aff6c2341f3a7efa Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Sun, 7 Aug 2005 20:01:24 +1000 Subject: [PATCH 2/3] Use lf translation rather than binary when reading commit data. The effect of this is that it allows Tcl to do the locale-specific conversion of the input data to its internal unicode representation. That means that commit messages in Russian or other languages should be displayed correctly now (according to the locale that is in effect.) --- gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk b/gitk index b38d7cd0ed..e21d7a28f1 100755 --- a/gitk +++ b/gitk @@ -48,7 +48,7 @@ proc getcommits {rargs} { exit 1 } set leftover {} - fconfigure $commfd -blocking 0 -translation binary + fconfigure $commfd -blocking 0 -translation lf fileevent $commfd readable "getcommitlines $commfd" $canv delete all $canv create text 3 3 -anchor nw -text "Reading commits..." \ From 200e7fbbac82b6665f8175af0e375fbef3568c30 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 7 Aug 2005 14:11:02 -0700 Subject: [PATCH 3/3] (revert local fix) Signed-off-by: Junio C Hamano --- gitk | 1 - 1 file changed, 1 deletion(-) diff --git a/gitk b/gitk index 63369f0ac1..59cdd853e2 100755 --- a/gitk +++ b/gitk @@ -1802,7 +1802,6 @@ proc selectline {l isnew} { set linkid [string range $comment $s $e] if {![info exists idline($linkid)]} continue incr e - incr i $ctext tag conf link$i -foreground blue -underline 1 $ctext tag add link$i "$commentstart + $s c" "$commentstart + $e c" $ctext tag bind link$i <1> [list selectline $idline($linkid) 1]