Skip to content

Commit 21ac8a8

Browse files
committed
gitk: Allow user to control how much of the SHA1 ID gets auto-selected
This adds a new spinbox on the Edit Preferences pane to allow the user to control how many characters of the SHA1 ID get autoselected. Signed-off-by: Paul Mackerras <[email protected]>
1 parent 7317a10 commit 21ac8a8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

gitk

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,7 +2652,7 @@ proc savestuff {w} {
26522652
global viewname viewfiles viewargs viewargscmd viewperm nextviewnum
26532653
global cmitmode wrapcomment datetimeformat limitdiffs
26542654
global colors uicolor bgcolor fgcolor diffcolors diffcontext selectbgcolor
2655-
global autoselect extdifftool perfile_attrs markbgcolor use_ttk
2655+
global autoselect autosellen extdifftool perfile_attrs markbgcolor use_ttk
26562656
global hideremotes want_ttk
26572657

26582658
if {$stuffsaved} return
@@ -2673,6 +2673,7 @@ proc savestuff {w} {
26732673
puts $f [list set cmitmode $cmitmode]
26742674
puts $f [list set wrapcomment $wrapcomment]
26752675
puts $f [list set autoselect $autoselect]
2676+
puts $f [list set autosellen $autosellen]
26762677
puts $f [list set showneartags $showneartags]
26772678
puts $f [list set hideremotes $hideremotes]
26782679
puts $f [list set showlocalchanges $showlocalchanges]
@@ -6896,7 +6897,7 @@ proc selectline {l isnew {desired_loc {}}} {
68966897
global mergemax numcommits pending_select
68976898
global cmitmode showneartags allcommits
68986899
global targetrow targetid lastscrollrows
6899-
global autoselect jump_to_here
6900+
global autoselect autosellen jump_to_here
69006901

69016902
catch {unset pending_select}
69026903
$canv delete hover
@@ -6958,7 +6959,7 @@ proc selectline {l isnew {desired_loc {}}} {
69586959
$sha1entry delete 0 end
69596960
$sha1entry insert 0 $id
69606961
if {$autoselect} {
6961-
$sha1entry selection range 0 end
6962+
$sha1entry selection range 0 $autosellen
69626963
}
69636964
rhighlight_sel $id
69646965

@@ -10756,7 +10757,7 @@ proc doprefs {} {
1075610757
global maxwidth maxgraphpct use_ttk NS
1075710758
global oldprefs prefstop showneartags showlocalchanges
1075810759
global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
10759-
global tabstop limitdiffs autoselect extdifftool perfile_attrs
10760+
global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
1076010761
global hideremotes want_ttk have_ttk
1076110762

1076210763
set top .gitkprefs
@@ -10784,9 +10785,10 @@ proc doprefs {} {
1078410785
${NS}::checkbutton $top.showlocal -text [mc "Show local changes"] \
1078510786
-variable showlocalchanges
1078610787
grid x $top.showlocal -sticky w
10787-
${NS}::checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \
10788+
${NS}::checkbutton $top.autoselect -text [mc "Auto-select SHA1 (length)"] \
1078810789
-variable autoselect
10789-
grid x $top.autoselect -sticky w
10790+
spinbox $top.autosellen -from 1 -to 40 -width 4 -textvariable autosellen
10791+
grid x $top.autoselect $top.autosellen -sticky w
1079010792
${NS}::checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
1079110793
-variable hideremotes
1079210794
grid x $top.hideremotes -sticky w
@@ -11428,6 +11430,7 @@ set showlocalchanges 1
1142811430
set limitdiffs 1
1142911431
set datetimeformat "%Y-%m-%d %H:%M:%S"
1143011432
set autoselect 1
11433+
set autosellen 40
1143111434
set perfile_attrs 0
1143211435
set want_ttk 1
1143311436

0 commit comments

Comments
 (0)