Skip to content

Commit 95293b5

Browse files
peffpaulusmack
authored andcommitted
[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>
1 parent a3a1f57 commit 95293b5

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

gitk

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,7 @@ proc savestuff {w} {
11811181
global viewname viewfiles viewargs viewargscmd viewperm nextviewnum
11821182
global cmitmode wrapcomment datetimeformat limitdiffs
11831183
global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
1184+
global autoselect
11841185

11851186
if {$stuffsaved} return
11861187
if {![winfo viewable .]} return
@@ -1195,6 +1196,7 @@ proc savestuff {w} {
11951196
puts $f [list set maxwidth $maxwidth]
11961197
puts $f [list set cmitmode $cmitmode]
11971198
puts $f [list set wrapcomment $wrapcomment]
1199+
puts $f [list set autoselect $autoselect]
11981200
puts $f [list set showneartags $showneartags]
11991201
puts $f [list set showlocalchanges $showlocalchanges]
12001202
puts $f [list set datetimeformat $datetimeformat]
@@ -4681,6 +4683,7 @@ proc selectline {l isnew} {
46814683
global commentend idtags linknum
46824684
global mergemax numcommits pending_select
46834685
global cmitmode showneartags allcommits
4686+
global autoselect
46844687

46854688
catch {unset pending_select}
46864689
$canv delete hover
@@ -4736,8 +4739,10 @@ proc selectline {l isnew} {
47364739
set currentid $id
47374740
$sha1entry delete 0 end
47384741
$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+
}
47414746
rhighlight_sel $id
47424747

47434748
$ctext conf -state normal
@@ -7974,7 +7979,7 @@ proc doprefs {} {
79747979
global maxwidth maxgraphpct
79757980
global oldprefs prefstop showneartags showlocalchanges
79767981
global bgcolor fgcolor ctext diffcolors selectbgcolor
7977-
global tabstop limitdiffs
7982+
global tabstop limitdiffs autoselect
79787983

79797984
set top .gitkprefs
79807985
set prefstop $top
@@ -8004,6 +8009,11 @@ proc doprefs {} {
80048009
checkbutton $top.showlocal.b -variable showlocalchanges
80058010
pack $top.showlocal.b $top.showlocal.l -side left
80068011
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
80078017

80088018
label $top.ddisp -text [mc "Diff display options"]
80098019
grid $top.ddisp - -sticky w -pady 10
@@ -8494,6 +8504,7 @@ set maxlinelen 200
84948504
set showlocalchanges 1
84958505
set limitdiffs 1
84968506
set datetimeformat "%Y-%m-%d %H:%M:%S"
8507+
set autoselect 1
84978508

84988509
set colors {green red blue magenta darkgrey brown orange}
84998510
set bgcolor white

0 commit comments

Comments
 (0)