git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] gitk: Add horizontal scrollbar to the diff view

From
PKPekka Kaitaniemi <kaitanie@cc.helsinki.fi>
Date
Mar 6, 2008, 12:38 UTC
Message-ID
<20080306123845.GA12115@localdomain>

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.

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>
---
This patch adds a relatively narrow horizontal scrollbar to the diff
pane. It might be a bit more complicated to implement an on-demand
one, however...

The patch seems to work fine on Linux and ion3 window manager. I haven't had a chance to test it with other systems.

 gitk |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/gitk b/gitk
index f1f21e9..5340811 100755
--- a/gitk
+++ b/gitk
@@ -857,14 +857,18 @@ proc makewindow {} {
     set ctext .bleft.ctext
     text $ctext -background $bgcolor -foreground $fgcolor \
 	-state disabled -font textfont \
-	-yscrollcommand scrolltext -wrap none
+	-yscrollcommand scrolltext  -wrap none \
+	-xscrollcommand ".bleft.sbhorizontal set"
     if {$have_tk85} {
 	$ctext conf -tabstyle wordprocessor
     }
     scrollbar .bleft.sb -command "$ctext yview"
+    scrollbar .bleft.sbhorizontal -command "$ctext xview" -orient h \
+	-width 10
     pack .bleft.top -side top -fill x
     pack .bleft.mid -side top -fill x
     pack .bleft.sb -side right -fill y
+    pack .bleft.sbhorizontal -side bottom -fill x -in .bleft
     pack $ctext -side left -fill both -expand 1
     lappend bglist $ctext
     lappend fglist $ctext
-- 
1.5.4.3
Next: Dirk Süsserott
Message 1 of 4 in “gitk: Add horizontal scrollbar to the diff view”
  1. gitk: Add horizontal scrollbar to the diff viewPekka Kaitaniemi, Mar 6, 2008
  2. Dirk SüsserottMar 6, 2008
  3. Paul MackerrasMar 6, 2008
  4. Pekka KaitaniemiMar 7, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.