summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bb3edc8)
raw | patch | inline | side by side (parent: bb3edc8)
author | Paul Mackerras <paulus@samba.org> | |
Fri, 28 Sep 2007 11:27:39 +0000 (21:27 +1000) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Fri, 28 Sep 2007 11:27:39 +0000 (21:27 +1000) |
This fixes the bug where we were using the wrong font to calculate
the width of the tab stops in the diff display window.
If we're running on Tk 8.5 we also use the new -tabstyle wordprocessor
option that makes tabs work as expected, i.e. a tab moves the cursor
to the right until the next tab stop is reached. On Tk 8.5 we also
get fancy and set the first tab stop at column 1 for a normal diff
or column N for a merge diff with N parents.
On Tk8.4 we can't do that because the tabs work in the "tabular"
style, i.e. the nth tab character moves to the location of the nth
tab position, *unless* you ask for the default tab setting, which
gives 8-column tabs that work in the "wordprocessor" mode. So on
Tk8.4 if the tab setting is 8 we ask for default tabs. This means
that a tab setting of 7 or 9 can look quite different to 8 in some
cases.
Signed-off-by: Paul Mackerras <paulus@samba.org>
the width of the tab stops in the diff display window.
If we're running on Tk 8.5 we also use the new -tabstyle wordprocessor
option that makes tabs work as expected, i.e. a tab moves the cursor
to the right until the next tab stop is reached. On Tk 8.5 we also
get fancy and set the first tab stop at column 1 for a normal diff
or column N for a merge diff with N parents.
On Tk8.4 we can't do that because the tabs work in the "tabular"
style, i.e. the nth tab character moves to the location of the nth
tab position, *unless* you ask for the default tab setting, which
gives 8-column tabs that work in the "wordprocessor" mode. So on
Tk8.4 if the tab setting is 8 we ask for default tabs. This means
that a tab setting of 7 or 9 can look quite different to 8 in some
cases.
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk | patch | blob | history |
index 4e168e98a0c49786e2e650a5aeba86fdd3c74cb0..01f5926916da4d0b69c12cd5bb46d61bb042dc72 100755 (executable)
--- a/gitk
+++ b/gitk
global bgcolor fgcolor bglist fglist diffcolors selectbgcolor
global headctxmenu progresscanv progressitem progresscoords statusw
global fprogitem fprogcoord lastprogupdate progupdatepending
+ global have_tk85
menu .bar
.bar add cascade -label "File" -menu .bar.file
pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left
set ctext .bleft.ctext
text $ctext -background $bgcolor -foreground $fgcolor \
- -tabs "[expr {$tabstop * $charspc}]" \
-state disabled -font $textfont \
-yscrollcommand scrolltext -wrap none
+ if {$have_tk85} {
+ $ctext conf -tabstyle wordprocessor
+ }
scrollbar .bleft.sb -command "$ctext yview"
pack .bleft.top -side top -fill x
pack .bleft.mid -side top -fill x
}
proc savestuff {w} {
- global canv canv2 canv3 ctext cflist mainfont textfont uifont tabstop
+ global canv canv2 canv3 mainfont textfont uifont tabstop
global stuffsaved findmergefiles maxgraphpct
global maxwidth showneartags showlocalchanges
global viewname viewfiles viewargs viewperm nextviewnum
$ctext insert end "$f\n" filesep
$ctext config -state disabled
$ctext yview $commentend
+ settabs 0
}
proc getblobline {bf id} {
fconfigure $mdf -blocking 0
set mdifffd($id) $mdf
set np [llength [lindex $parentlist $l]]
+ settabs $np
filerun $mdf [list getmergediffline $mdf $id $np]
}
proc startdiff {ids} {
global treediffs diffids treepending diffmergeid nullid nullid2
+ settabs 1
set diffids $ids
catch {unset diffmergeid}
if {![info exists treediffs($ids)] ||
}
}
+proc settabs {{firstab {}}} {
+ global firsttabstop tabstop textfont ctext have_tk85
+
+ if {$firstab ne {} && $have_tk85} {
+ set firsttabstop $firstab
+ }
+ set w [font measure $textfont "0"]
+ if {$firsttabstop != 0} {
+ $ctext conf -tabs [list [expr {$firsttabstop * $w}] \
+ [expr {($firsttabstop + $tabstop) * $w}]]
+ } elseif {$have_tk85 || $tabstop != 8} {
+ $ctext conf -tabs [expr {$tabstop * $w}]
+ } else {
+ $ctext conf -tabs {}
+ }
+}
+
proc incrsearch {name ix op} {
global ctext searchstring searchdirn
proc incrfont {inc} {
global mainfont textfont ctext canv phase cflist showrefstop
- global charspc tabstop
global stopped entries
unmarkmatches
set mainfont [lreplace $mainfont 1 1 [expr {[lindex $mainfont 1] + $inc}]]
set textfont [lreplace $textfont 1 1 [expr {[lindex $textfont 1] + $inc}]]
setcoords
- $ctext conf -font $textfont -tabs "[expr {$tabstop * $charspc}]"
+ settabs
$cflist conf -font $textfont
$ctext tag conf filesep -font [concat $textfont bold]
foreach e $entries {
# fill the details pane with info about this line
$ctext conf -state normal
clear_ctext
+ settabs 0
$ctext insert end "Parent:\t"
$ctext insert end $id link0
setlink $id link0
}
$ctext conf -state normal
clear_ctext
+ settabs 0
set linknum 0
if {![info exists tagcontents($tag)]} {
catch {
proc prefsok {} {
global maxwidth maxgraphpct
global oldprefs prefstop showneartags showlocalchanges
- global charspc ctext tabstop
catch {destroy $prefstop}
unset prefstop
- $ctext configure -tabs "[expr {$tabstop * $charspc}]"
+ settabs
if {$showlocalchanges != $oldprefs(showlocalchanges)} {
if {$showlocalchanges} {
doshowlocalchanges
set nullid "0000000000000000000000000000000000000000"
set nullid2 "0000000000000000000000000000000000000001"
+set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
set runq {}
set history {}
set linkentercount 0
set need_redisplay 0
set nrows_drawn 0
+set firsttabstop 0
set nextviewnum 1
set curview 0