Skip to content

Commit 8809d69

Browse files
Pekka Kaitaniemipaulusmack
authored andcommitted
[PATCH] gitk: Add horizontal scrollbar to the diff view
Adding horizontal scroll bar makes the scrolling feature more discoverable to the users. The horizontal scrollbar is a bit narrower than vertical ones so we don't make too big impact on available screen real estate. The text and scrollbar widget layout is done using grid geometry manager. An interesting side effect of Tk scrollbars is that the "elevator" size changes depending on the visible content. So the horizontal scrollbar "elevator" changes as the user scrolls the view up and down. Signed-off-by: Pekka Kaitaniemi <kaitanie@cc.helsinki.fi> Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent 95293b5 commit 8809d69

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

gitk

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,7 @@ proc makewindow {} {
837837
}
838838
frame .bleft.top
839839
frame .bleft.mid
840+
frame .bleft.bottom
840841

841842
button .bleft.top.search -text [mc "Search"] -command dosearch
842843
pack .bleft.top.search -side left -padx 5
@@ -864,18 +865,25 @@ proc makewindow {} {
864865
checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \
865866
-command changeignorespace -variable ignorespace
866867
pack .bleft.mid.ignspace -side left -padx 5
867-
set ctext .bleft.ctext
868+
set ctext .bleft.bottom.ctext
868869
text $ctext -background $bgcolor -foreground $fgcolor \
869870
-state disabled -font textfont \
870-
-yscrollcommand scrolltext -wrap none
871+
-yscrollcommand scrolltext -wrap none \
872+
-xscrollcommand ".bleft.bottom.sbhorizontal set"
871873
if {$have_tk85} {
872874
$ctext conf -tabstyle wordprocessor
873875
}
874-
scrollbar .bleft.sb -command "$ctext yview"
876+
scrollbar .bleft.bottom.sb -command "$ctext yview"
877+
scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h \
878+
-width 10
875879
pack .bleft.top -side top -fill x
876880
pack .bleft.mid -side top -fill x
877-
pack .bleft.sb -side right -fill y
878-
pack $ctext -side left -fill both -expand 1
881+
grid $ctext .bleft.bottom.sb -sticky nsew
882+
grid .bleft.bottom.sbhorizontal -sticky ew
883+
grid columnconfigure .bleft.bottom 0 -weight 1
884+
grid rowconfigure .bleft.bottom 0 -weight 1
885+
grid rowconfigure .bleft.bottom 1 -weight 0
886+
pack .bleft.bottom -side top -fill both -expand 1
879887
lappend bglist $ctext
880888
lappend fglist $ctext
881889

@@ -5640,7 +5648,7 @@ proc searchmarkvisible {doall} {
56405648
proc scrolltext {f0 f1} {
56415649
global searchstring
56425650

5643-
.bleft.sb set $f0 $f1
5651+
.bleft.bottom.sb set $f0 $f1
56445652
if {$searchstring ne {}} {
56455653
searchmarkvisible 0
56465654
}

0 commit comments

Comments
 (0)