@matheusbsbs / matheus-bagliano / commits / 95293b58eb
Fork 0

[PATCH] gitk: make autoselect optional

Whenever a commit is selected in the graph pane, its SHA1 is automatically put into the selection buffer for cut and paste. However, some users may find this behavior annoying since it can overwrite something they actually wanted to keep in the buffer. This makes the behavior optional under the name "Auto-select SHA1", but continues to default to "on". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Paul Mackerras <paulus@samba.org>

Jeff King committed Mar 6, 2008 at 06:49 UTC 95293b58eb2ac31f93266f9e86ea17c0999d75c9
1 file changed +14 -3
gitk
+14 -3
@@ -1181,6 +1181,7 @@ proc savestuff {w} {
1181 global viewname viewfiles viewargs viewargscmd viewperm nextviewnum
1182 global cmitmode wrapcomment datetimeformat limitdiffs
1183 global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
1184 + global autoselect
1185
1186 if {$stuffsaved} return
1187 if {![winfo viewable .]} return
@@ -1195,6 +1196,7 @@ proc savestuff {w} {
1196 puts $f [list set maxwidth $maxwidth]
1197 puts $f [list set cmitmode $cmitmode]
1198 puts $f [list set wrapcomment $wrapcomment]
1199 + puts $f [list set autoselect $autoselect]
1200 puts $f [list set showneartags $showneartags]
1201 puts $f [list set showlocalchanges $showlocalchanges]
1202 puts $f [list set datetimeformat $datetimeformat]
@@ -4681,6 +4683,7 @@ proc selectline {l isnew} {
4683 global commentend idtags linknum
4684 global mergemax numcommits pending_select
4685 global cmitmode showneartags allcommits
4686 + global autoselect
4687
4688 catch {unset pending_select}
4689 $canv delete hover
@@ -4736,8 +4739,10 @@ proc selectline {l isnew} {
4739 set currentid $id
4740 $sha1entry delete 0 end
4741 $sha1entry insert 0 $id
4739 - $sha1entry selection from 0
4740 - $sha1entry selection to end
4742 + if {$autoselect} {
4743 + $sha1entry selection from 0
4744 + $sha1entry selection to end
4745 + }
4746 rhighlight_sel $id
4747
4748 $ctext conf -state normal
@@ -7974,7 +7979,7 @@ proc doprefs {} {
7979 global maxwidth maxgraphpct
7980 global oldprefs prefstop showneartags showlocalchanges
7981 global bgcolor fgcolor ctext diffcolors selectbgcolor
7977 - global tabstop limitdiffs
7982 + global tabstop limitdiffs autoselect
7983
7984 set top .gitkprefs
7985 set prefstop $top
@@ -8004,6 +8009,11 @@ proc doprefs {} {
8009 checkbutton $top.showlocal.b -variable showlocalchanges
8010 pack $top.showlocal.b $top.showlocal.l -side left
8011 grid x $top.showlocal -sticky w
8012 + frame $top.autoselect
8013 + label $top.autoselect.l -text [mc "Auto-select SHA1"] -font optionfont
8014 + checkbutton $top.autoselect.b -variable autoselect
8015 + pack $top.autoselect.b $top.autoselect.l -side left
8016 + grid x $top.autoselect -sticky w
8017
8018 label $top.ddisp -text [mc "Diff display options"]
8019 grid $top.ddisp - -sticky w -pady 10
@@ -8494,6 +8504,7 @@ set maxlinelen 200
8504 set showlocalchanges 1
8505 set limitdiffs 1
8506 set datetimeformat "%Y-%m-%d %H:%M:%S"
8507 +set autoselect 1
8508
8509 set colors {green red blue magenta darkgrey brown orange}
8510 set bgcolor white