[PATCH] gitk: Allow specifying tabstop as other than default 8 characters.
Not all projects use the convention that one tabstop = 8 characters, and a common convention is to use one tabstop = one level of indent. For such projects, using 8 characters per tabstop often shows too much whitespace per indent. This allows the user to configure the number of characters to use per tabstop. Signed-off-by: Mark Levedahl <mdl123@verizon.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
Mark Levedahl committed
May 20, 2007 at 11:45 UTC
7e12f1a6291032a311ab592e42fd38f5ec358c0e
1 file changed
+13
-4
gitk
+13
-4
@@ -395,7 +395,7 @@ proc confirm_popup msg {
395
396
proc makewindow {} {
397
global canv canv2 canv3 linespc charspc ctext cflist
398
- global textfont mainfont uifont
398
+ global textfont mainfont uifont tabstop
399
global findtype findtypemenu findloc findstring fstring geometry
400
global entries sha1entry sha1string sha1but
401
global maincursor textcursor curtextcursor
@@ -615,6 +615,7 @@ proc makewindow {} {
615
pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
616
set ctext .bleft.ctext
617
text $ctext -background $bgcolor -foreground $fgcolor \
618
+ -tabs "[expr {$tabstop * $charspc}]" \
619
-state disabled -font $textfont \
620
-yscrollcommand scrolltext -wrap none
621
scrollbar .bleft.sb -command "$ctext yview"
@@ -824,7 +825,7 @@ proc click {w} {
825
}
826
827
proc savestuff {w} {
827
- global canv canv2 canv3 ctext cflist mainfont textfont uifont
828
+ global canv canv2 canv3 ctext cflist mainfont textfont uifont tabstop
829
global stuffsaved findmergefiles maxgraphpct
830
global maxwidth showneartags
831
global viewname viewfiles viewargs viewperm nextviewnum
@@ -838,6 +839,7 @@ proc savestuff {w} {
839
puts $f [list set mainfont $mainfont]
840
puts $f [list set textfont $textfont]
841
puts $f [list set uifont $uifont]
842
+ puts $f [list set tabstop $tabstop]
843
puts $f [list set findmergefiles $findmergefiles]
844
puts $f [list set maxgraphpct $maxgraphpct]
845
puts $f [list set maxwidth $maxwidth]
@@ -4696,12 +4698,13 @@ proc redisplay {} {
4698
4699
proc incrfont {inc} {
4700
global mainfont textfont ctext canv phase cflist
4701
+ global charspc tabstop
4702
global stopped entries
4703
unmarkmatches
4704
set mainfont [lreplace $mainfont 1 1 [expr {[lindex $mainfont 1] + $inc}]]
4705
set textfont [lreplace $textfont 1 1 [expr {[lindex $textfont 1] + $inc}]]
4706
setcoords
4704
- $ctext conf -font $textfont
4707
+ $ctext conf -font $textfont -tabs "[expr {$tabstop * $charspc}]"
4708
$cflist conf -font $textfont
4709
$ctext tag conf filesep -font [concat $textfont bold]
4710
foreach e $entries {
@@ -5852,7 +5855,7 @@ proc doprefs {} {
5855
global maxwidth maxgraphpct diffopts
5856
global oldprefs prefstop showneartags
5857
global bgcolor fgcolor ctext diffcolors selectbgcolor
5855
- global uifont
5858
+ global uifont tabstop
5859
5860
set top .gitkprefs
5861
set prefstop $top
@@ -5890,6 +5893,9 @@ proc doprefs {} {
5893
checkbutton $top.ntag.b -variable showneartags
5894
pack $top.ntag.b $top.ntag.l -side left
5895
grid x $top.ntag -sticky w
5896
+ label $top.tabstopl -text "tabstop" -font optionfont
5897
+ entry $top.tabstop -width 10 -textvariable tabstop
5898
+ grid x $top.tabstopl $top.tabstop -sticky w
5899
5900
label $top.cdisp -text "Colors: press to choose"
5901
$top.cdisp configure -font $uifont
@@ -5988,9 +5994,11 @@ proc prefscan {} {
5994
proc prefsok {} {
5995
global maxwidth maxgraphpct
5996
global oldprefs prefstop showneartags
5997
+ global charspc ctext tabstop
5998
5999
catch {destroy $prefstop}
6000
unset prefstop
6001
+ $ctext configure -tabs "[expr {$tabstop * $charspc}]"
6002
if {$maxwidth != $oldprefs(maxwidth)
6003
|| $maxgraphpct != $oldprefs(maxgraphpct)} {
6004
redisplay
@@ -6296,6 +6304,7 @@ if {$tclencoding == {}} {
6304
set mainfont {Helvetica 9}
6305
set textfont {Courier 9}
6306
set uifont {Helvetica 9 bold}
6307
+set tabstop 8
6308
set findmergefiles 0
6309
set maxgraphpct 50
6310
set maxwidth 16