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

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

From
PKPekka Kaitaniemi <kaitanie@cc.helsinki.fi>
Date
Mar 6, 2008, 11:53 UTC
Message-ID
<20080306115347.GA11808@localdomain>
In-Reply-To
<18383.51154.695501.543720@cargo.ozlabs.ibm.com>
Hi,
On Thu, Mar 06, 2008 at 09:30:42PM +1100, Paul Mackerras wrote:
Show 11 quoted lines
> Junio C Hamano writes:
> 
> > An obvious solution is to show the scrollbar on-demand (i.e. when the
> > lines are overlong), but I do not talk Tcl/Tk and do not know if you can
> > do that easily.
> 
> I don't know of any extremely easy way to do it; it's certainly
> possible, but I think I would have to calculate the length of each
> line as it is put in, so as to get the maximum, and then have a
> handler for when the pane is resized, and pack and unpack the
> scrollbar as necessary.

I have spent some time today looking for examples on Tk scrollbar handling (I'm not really a Tcl/Tk guru) and I haven't found any really easy ways either.

> I think it's reasonable to have the scroll bar there always.  I think
> that pane could look better using the grid geometry manager (instead
> of pack), but that can be a separate patch.

I have modified the patch a bit to make the horizontal scrollbar a bit narrower so the impact on screen real estate should be smaller now.

The grid layout manager would probably be a bit better than pack for the left pane. At least most examples of "text and two scrollbars" case seem to be using it. Maybe I can try to prepare a patch that converts the diff pane from pack to grid layout.

An interesting side effect of Tk scrollbars is that by default the "elevator" size changes depending on the _visible_ content. So the horizontal scrollbar "elevator" changes as the user scrolls the view up and down.

Pekka
Previous: Paul MackerrasNext: Shawn O. Pearce
Message 4 of 7 in “gitk: Add horizontal scrollbar to the diff view”
  1. gitk: Add horizontal scrollbar to the diff viewPekka Kaitaniemi, Mar 5, 2008
  2. Junio C HamanoMar 6, 2008
  3. Paul MackerrasMar 6, 2008
  4. Pekka KaitaniemiMar 6, 2008
  5. Shawn O. PearceMar 8, 2008
  6. Paul MackerrasMar 8, 2008
  7. Shawn O. PearceMar 8, 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.