@@ -1877,8 +1877,11 @@ proc setoptions {} {
18771877 option add *Menubutton.font uifont startupFile
18781878 option add *Label.font uifont startupFile
18791879 option add *Message.font uifont startupFile
1880- option add *Entry.font uifont startupFile
1880+ option add *Entry.font textfont startupFile
1881+ option add *Text.font textfont startupFile
18811882 option add *Labelframe.font uifont startupFile
1883+ option add *Spinbox.font textfont startupFile
1884+ option add *Listbox.font mainfont startupFile
18821885}
18831886
18841887# Make a menu and submenus.
@@ -2174,7 +2177,7 @@ proc makewindow {} {
21742177 set findstring {}
21752178 set fstring .tf.lbar.findstring
21762179 lappend entries $fstring
2177- ${NS} ::entry $fstring -width 30 -font textfont - textvariable findstring
2180+ ${NS} ::entry $fstring -width 30 -textvariable findstring
21782181 trace add variable findstring write find_change
21792182 set findtype [mc " Exact" ]
21802183 set findtypemenu [makedroplist .tf.lbar.findtype \
@@ -2217,7 +2220,7 @@ proc makewindow {} {
22172220 pack .bleft.top.search -side left -padx 5
22182221 set sstring .bleft.top.sstring
22192222 set searchstring " "
2220- ${NS} ::entry $sstring -width 20 -font textfont - textvariable searchstring
2223+ ${NS} ::entry $sstring -width 20 -textvariable searchstring
22212224 lappend entries $sstring
22222225 trace add variable searchstring write incrsearch
22232226 pack $sstring -side left -expand 1 -fill x
@@ -2229,7 +2232,7 @@ proc makewindow {} {
22292232 -command changediffdisp -variable diffelide -value {1 0}
22302233 ${NS} ::label .bleft.mid.labeldiffcontext -text " [ mc " Lines of context" ] : "
22312234 pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
2232- spinbox .bleft.mid.diffcontext -width 5 -font textfont \
2235+ spinbox .bleft.mid.diffcontext -width 5 \
22332236 -from 0 -increment 1 -to 10000000 \
22342237 -validate all -validatecommand " diffcontextvalidate %P" \
22352238 -textvariable diffcontextstring
@@ -2383,6 +2386,8 @@ proc makewindow {} {
23832386 }
23842387 bindall <$::BM > " canvscan mark %W %x %y"
23852388 bindall <B$::BM -Motion> " canvscan dragto %W %x %y"
2389+ bind all <$M1B -Key-w> {destroy [winfo toplevel %W]}
2390+ bind . <$M1B -Key-w> doquit
23862391 bindkey <Home> selfirstline
23872392 bindkey <End> sellastline
23882393 bind . <Key-Up> " selnextline -1"
@@ -2782,7 +2787,7 @@ proc about {} {
27822787 message $w .m -text [mc "
27832788Gitk - a commit viewer for git
27842789
2785- Copyright © 2005-2009 Paul Mackerras
2790+ Copyright \u00a9 2005-2010 Paul Mackerras
27862791
27872792Use and redistribute under the terms of the GNU General Public License" ] \
27882793 -justify center -aspect 400 -border 2 -bg white -relief groove
@@ -2814,6 +2819,7 @@ proc keys {} {
28142819[ mc " Gitk key bindings:" ]
28152820
28162821[ mc " <%s-Q> Quit" $M1T ]
2822+ [ mc " <%s-W> Close window" $M1T ]
28172823[ mc " <Home> Move to first commit" ]
28182824[ mc " <End> Move to last commit" ]
28192825[ mc " <Up>, p, i Move up one commit" ]
@@ -3805,10 +3811,10 @@ proc newview {ishighlight} {
38053811 raise $top
38063812 return
38073813 }
3814+ decode_view_opts $nextviewnum $revtreeargs
38083815 set newviewname($nextviewnum ) " [ mc " View" ] $nextviewnum "
38093816 set newviewopts($nextviewnum ,perm) 0
38103817 set newviewopts($nextviewnum ,cmd) $viewargscmd($curview)
3811- decode_view_opts $nextviewnum $revtreeargs
38123818 vieweditor $top $nextviewnum [mc " Gitk view definition" ]
38133819}
38143820
@@ -3845,6 +3851,7 @@ set known_view_options {
38453851 {cmd t50= + {} {mc " Command to generate more commits to include:" }}
38463852 }
38473853
3854+ # Convert $newviewopts($n, ...) into args for git log.
38483855proc encode_view_opts {n} {
38493856 global known_view_options newviewopts
38503857
@@ -3878,6 +3885,7 @@ proc encode_view_opts {n} {
38783885 return [concat $rargs [shellsplit $newviewopts($n,args) ]]
38793886}
38803887
3888+ # Fill $newviewopts($n, ...) based on args for git log.
38813889proc decode_view_opts {n view_args} {
38823890 global known_view_options newviewopts
38833891
@@ -3960,10 +3968,10 @@ proc editview {} {
39603968 raise $top
39613969 return
39623970 }
3971+ decode_view_opts $curview $viewargs($curview)
39633972 set newviewname($curview ) $viewname($curview)
39643973 set newviewopts($curview ,perm) $viewperm($curview)
39653974 set newviewopts($curview ,cmd) $viewargscmd($curview)
3966- decode_view_opts $curview $viewargs($curview)
39673975 vieweditor $top $curview " [ mc " Gitk: edit view" ] $viewname($curview) "
39683976}
39693977
@@ -4037,7 +4045,7 @@ proc vieweditor {top n title} {
40374045 } elseif {$type eq " path" } {
40384046 ${NS} ::label $top .l -text $title
40394047 pack $top .l -in $top -side top -pady [list 3 0] -anchor w -padx 3
4040- text $top .t -width 40 -height 5 -background $bgcolor -font uifont
4048+ text $top .t -width 40 -height 5 -background $bgcolor
40414049 if {[info exists viewfiles($n )]} {
40424050 foreach f $viewfiles($n) {
40434051 $top .t insert end $f
@@ -7501,7 +7509,7 @@ proc getblobdiffs {ids} {
75017509 global ignorespace
75027510 global limitdiffs vfilelimit curview
75037511 global diffencoding targetline diffnparents
7504- global git_version
7512+ global git_version currdiffsubmod
75057513
75067514 set textconv {}
75077515 if {[package vcompare $git_version " 1.6.1" ] >= 0} {
@@ -7528,6 +7536,7 @@ proc getblobdiffs {ids} {
75287536 set diffencoding [get_path_encoding {}]
75297537 fconfigure $bdf -blocking 0 -encoding binary -eofchar {}
75307538 set blobdifffd($ids ) $bdf
7539+ set currdiffsubmod " "
75317540 filerun $bdf [list getblobdiffline $bdf $diffids ]
75327541}
75337542
@@ -7598,7 +7607,7 @@ proc getblobdiffline {bdf ids} {
75987607 global diffnexthead diffnextnote difffilestart
75997608 global ctext_file_names ctext_file_lines
76007609 global diffinhdr treediffs mergemax diffnparents
7601- global diffencoding jump_to_here targetline diffline
7610+ global diffencoding jump_to_here targetline diffline currdiffsubmod
76027611
76037612 set nr 0
76047613 $ctext conf -state normal
@@ -7679,19 +7688,30 @@ proc getblobdiffline {bdf ids} {
76797688
76807689 } elseif {![string compare -length 10 " Submodule " $line ]} {
76817690 # start of a new submodule
7682- if {[string compare [$ctext get " end - 4c" end] " \n \n\n " ]} {
7691+ if {[regexp -indices "\[ 0-9a-f\] +\\ .\\ ." $line nameend]} {
7692+ set fname [string range $line 10 [expr [lindex $nameend 0] - 2]]
7693+ } else {
7694+ set fname [string range $line 10 [expr [string first " contains " $line ] - 2]]
7695+ }
7696+ if {$currdiffsubmod != $fname } {
76837697 $ctext insert end " \n " ; # Add newline after commit message
76847698 }
76857699 set curdiffstart [$ctext index " end - 1c" ]
76867700 lappend ctext_file_names " "
7687- set fname [string range $line 10 [expr [string last " " $line ] - 1]]
7688- lappend ctext_file_lines $fname
7689- makediffhdr $fname $ids
7690- $ctext insert end " \n $line \n " filesep
7701+ if {$currdiffsubmod != $fname } {
7702+ lappend ctext_file_lines $fname
7703+ makediffhdr $fname $ids
7704+ set currdiffsubmod $fname
7705+ $ctext insert end " \n $line \n " filesep
7706+ } else {
7707+ $ctext insert end " $line \n " filesep
7708+ }
76917709 } elseif {![string compare -length 3 " >" $line ]} {
7710+ set $currdiffsubmod " "
76927711 set line [encoding convertfrom $diffencoding $line ]
76937712 $ctext insert end " $line \n " dresult
76947713 } elseif {![string compare -length 3 " <" $line ]} {
7714+ set $currdiffsubmod " "
76957715 set line [encoding convertfrom $diffencoding $line ]
76967716 $ctext insert end " $line \n " d0
76977717 } elseif {$diffinhdr } {
@@ -8527,7 +8547,7 @@ proc do_cmp_commits {a b} {
85278547}
85288548
85298549proc diffcommits {a b} {
8530- global diffcontext diffids blobdifffd diffinhdr
8550+ global diffcontext diffids blobdifffd diffinhdr currdiffsubmod
85318551
85328552 set tmpdir [gitknewtmpdir]
85338553 set fna [file join $tmpdir " commit-[ string range $a 0 7] " ]
@@ -8548,6 +8568,7 @@ proc diffcommits {a b} {
85488568 set diffids [list commits $a $b ]
85498569 set blobdifffd($diffids ) $fd
85508570 set diffinhdr 0
8571+ set currdiffsubmod " "
85518572 filerun $fd [list getblobdiffline $fd $diffids ]
85528573}
85538574
@@ -10528,7 +10549,6 @@ proc mkfontdisp {font top which} {
1052810549 set fontpref($font ) [set $font ]
1052910550 ${NS} ::button $top .${font} but -text $which \
1053010551 -command [list choosefont $font $which ]
10531- if {!$use_ttk } {$top .${font} but configure -font optionfont}
1053210552 ${NS} ::label $top .$font -relief flat -font $font \
1053310553 -text $fontattr($font,family) -justify left
1053410554 grid x $top .${font} but $top .$font -sticky w
@@ -10791,15 +10811,6 @@ proc doprefs {} {
1079110811 mkfontdisp textfont $top [mc " Diff display font" ]
1079210812 mkfontdisp uifont $top [mc " User interface font" ]
1079310813
10794- if {!$use_ttk } {
10795- foreach w {maxpctl maxwidthl showlocal autoselect tabstopl ntag
10796- ldiff lattr extdifff.l extdifff.b bgbut fgbut
10797- diffoldbut diffnewbut hunksepbut markbgbut selbgbut
10798- want_ttk ttk_note} {
10799- $top .$w configure -font optionfont
10800- }
10801- }
10802-
1080310814 ${NS} ::frame $top .buts
1080410815 ${NS} ::button $top .buts.ok -text [mc " OK" ] -command prefsok -default active
1080510816 ${NS} ::button $top .buts.can -text [mc " Cancel" ] -command prefscan -default normal
@@ -10849,6 +10860,7 @@ proc setselbg {c} {
1084910860# radiobuttons look bad. This chooses white for selectColor if the
1085010861# background color is light, or black if it is dark.
1085110862proc setui {c} {
10863+ if {[tk windowingsystem] eq " win32" } { return }
1085210864 set bg [winfo rgb . $c ]
1085310865 set selc black
1085410866 if {[lindex $bg 0] + 1.5 * [lindex $bg 1] + 0.5 * [lindex $bg 2] > 100000} {
@@ -11411,8 +11423,6 @@ namespace import ::msgcat::mc
1141111423
1141211424catch {source ~/.gitk}
1141311425
11414- font create optionfont -family sans-serif -size -12
11415-
1141611426parsefont mainfont $mainfont
1141711427eval font create mainfont [fontflags mainfont]
1141811428eval font create mainfontbold [fontflags mainfont 1]
@@ -11613,3 +11623,9 @@ if {[tk windowingsystem] eq "win32"} {
1161311623}
1161411624
1161511625getcommits {}
11626+
11627+ # Local variables:
11628+ # mode: tcl
11629+ # indent-tabs-mode: t
11630+ # tab-width: 8
11631+ # End:
0 commit comments