]> git.ipfire.org Git - thirdparty/git.git/commitdiff
gitk: add horizontal scrollbar to the commit list pane
authorRob McDonald <rob.a.mcdonald@gmail.com>
Tue, 14 Apr 2026 16:34:03 +0000 (09:34 -0700)
committerRob McDonald <rob.a.mcdonald@gmail.com>
Sat, 18 Apr 2026 15:41:54 +0000 (08:41 -0700)
When many branches and tags decorate the same commit, the ref labels
push the commit description far to the right, often out of the visible
area of the left pane.  The canvas widget already tracked the maximum
x extent via canvxmax and updated its scrollregion accordingly, but
there was no scrollbar wired up to let the user reach that content.

Add a horizontal scrollbar (.tf.histframe.cxsb) below the three-pane
history area, connected to the left canvas (canv) via its xscrollcommand
and xview.

No behaviour is changed for the author (canv2) or date (canv3) panes;
they continue to scroll only vertically in lock-step as before.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Rob McDonald <rob.a.mcdonald@gmail.com>
gitk

diff --git a/gitk b/gitk
index 27302749669c21b311be0e0f576f9600a4a858a6..0f3571050bef1cc516473ba174f5fe2f5d065882 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -2469,7 +2469,8 @@ proc makewindow {} {
         -selectbackground $selectbgcolor \
         -background $bgcolor -bd 0 \
         -xscrollincr $linespc \
-        -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll"
+        -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll" \
+        -xscrollcommand ".tf.histframe.cxsb set"
     .tf.histframe.pwclist add $canv
     set canv2 .tf.histframe.pwclist.canv2
     canvas $canv2 \
@@ -2487,9 +2488,11 @@ proc makewindow {} {
         .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0]
     }
 
-    # a scroll bar to rule them
+    # a scroll bar to rule them (vertical), and one for horizontal scroll of left pane
     ttk::scrollbar $cscroll -command {allcanvs yview}
     pack $cscroll -side right -fill y
+    ttk::scrollbar .tf.histframe.cxsb -orient horizontal -command "$canv xview"
+    pack .tf.histframe.cxsb -side bottom -fill x
     bind .tf.histframe.pwclist <Configure> {resizeclistpanes %W %w}
     lappend bglist $canv $canv2 $canv3
     pack .tf.histframe.pwclist -fill both -expand 1 -side left