Skip to content

Commit 9abe70d

Browse files
Michael Rappazzoj6t
authored andcommitted
gitk: make 'sort-refs-by-type' optional and persistent
On the 'tags and heads' view, add an option to enable or disable 'Sort refs by type'. This option is read from and written to the config file. Clicking on the option will update the refs in the view. Signed-off-by: Michael Rappazzo <[email protected]> Signed-off-by: Johannes Sixt <[email protected]>
1 parent aa1a3e0 commit 9abe70d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gitk

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10261,6 +10261,9 @@ proc showrefs {} {
1026110261
pack $top.f.e -side right -fill x -expand 1
1026210262
pack $top.f.l -side left
1026310263
grid $top.f - -sticky ew -pady 2
10264+
${NS}::checkbutton $top.sort -text [mc "Sort refs by type"] \
10265+
-variable sortrefsbytype -command {refill_reflist}
10266+
grid $top.sort - -sticky w -pady 2
1026410267
${NS}::button $top.close -command [list destroy $top] -text [mc "Close"]
1026510268
bind $top <Key-Escape> [list destroy $top]
1026610269
grid $top.close -
@@ -10304,7 +10307,7 @@ proc reflistfilter_change {n1 n2 op} {
1030410307
}
1030510308
1030610309
proc refill_reflist {} {
10307-
global reflist reflistfilter showrefstop headids tagids otherrefids
10310+
global reflist reflistfilter showrefstop headids tagids otherrefids sortrefsbytype
1030810311
global curview
1030910312
1031010313
if {![info exists showrefstop] || ![winfo exists $showrefstop]} return
@@ -10356,7 +10359,11 @@ proc refill_reflist {} {
1035610359
}
1035710360
}
1035810361
set otherrefs [lsort -index 0 $otherrefs]
10362+
1035910363
set refs [concat $localrefs $remoterefs $tagrefs $otherrefs]
10364+
if {!$sortrefsbytype} {
10365+
set refs [lsort -index 0 $refs]
10366+
}
1036010367
1036110368
if {$refs eq $reflist} return
1036210369
@@ -12618,6 +12625,7 @@ set wrapcomment "none"
1261812625
set wrapdefault "none"
1261912626
set showneartags 1
1262012627
set hideremotes 0
12628+
set sortrefsbytype 1
1262112629
set maxrefs 20
1262212630
set visiblerefs {"master"}
1262312631
set maxlinelen 200
@@ -12732,7 +12740,7 @@ set config_variables {
1273212740
filesepbgcolor filesepfgcolor linehoverbgcolor linehoverfgcolor
1273312741
linehoveroutlinecolor mainheadcirclecolor workingfilescirclecolor
1273412742
indexcirclecolor circlecolors linkfgcolor circleoutlinecolor diffbgcolors
12735-
web_browser
12743+
sortrefsbytype web_browser
1273612744
}
1273712745
foreach var $config_variables {
1273812746
config_init_trace $var

0 commit comments

Comments
 (0)