{"thread":{"id":"35246","subject":"[PATCH v2] gitk: Add a horizontal scrollbar for commit history","startedAt":"2013-10-30T10:58:22Z","lastAt":"2013-11-04T15:50:04Z","messageCount":9,"participants":["Nicolas Cornu","Johannes Sixt","Marc Branchaud","Paul Mackerras","Heiko Voigt"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"229808","messageId":"1383130702-4966-1-git-send-email-ncornu@aldebaran-robotics.com","threadId":"35246","inReplyTo":null,"subject":"[PATCH v2] gitk: Add a horizontal scrollbar for commit history","fromName":"Nicolas Cornu","fromEmail":"ncornu@aldebaran-robotics.com","sentAt":"2013-10-30T10:58:22Z","receivedAt":"2013-10-30T10:58:22Z","isPatch":true,"sender":{"key":"ncornu@aldebaran-robotics.com","avatar":null},"body":"This scrollbar is not optional and is useful if there is a lot of tags or\nbranches.\n\nSigned-off-by: Nicolas Cornu <ncornu@aldebaran-robotics.com>\n---\n gitk | 8 +++++++-\n 1 file changed, 7 insertions(+), 1 deletion(-)\n\ndiff --git a/gitk b/gitk\nindex 5cd00d8..62563b1 100755\n--- a/gitk\n+++ b/gitk\n@@ -2120,11 +2120,17 @@ proc makewindow {} {\n     # create three canvases\n     set cscroll .tf.histframe.csb\n     set canv .tf.histframe.pwclist.canv\n+    set cscrollhl .tf.histframe.pwclist.canv.csb\n     canvas $canv \\\n \t-selectbackground $selectbgcolor \\\n \t-background $bgcolor -bd 0 \\\n-\t-yscrollincr $linespc -yscrollcommand \"scrollcanv $cscroll\"\n+\t-yscrollincr $linespc -yscrollcommand \"scrollcanv $cscroll\" \\\n+\t-xscrollcommand \"scrollcanv $cscrollhl\"\n     .tf.histframe.pwclist add $canv\n+    ${NS}::scrollbar $cscrollhl -command {$canv xview} -orient horizontal\n+    if {!$use_ttk} {$cscrollhl configure -highlightthickness 0}\n+    pack $cscrollhl -fill x -side bottom\n+\n     set canv2 .tf.histframe.pwclist.canv2\n     canvas $canv2 \\\n \t-selectbackground $selectbgcolor \\\n--\n1.8.4.2\n"},{"id":"229810","messageId":"5270F4FC.60900@viscovery.net","threadId":"35246","inReplyTo":"1383130702-4966-1-git-send-email-ncornu@aldebaran-robotics.com","subject":"Re: [PATCH v2] gitk: Add a horizontal scrollbar for commit history","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-10-30T12:01:00Z","receivedAt":"2013-10-30T12:01:00Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10/30/2013 11:58, schrieb Nicolas Cornu:\n> This scrollbar is not optional and is useful if there is a lot of tags or\n> branches.\n\nIf this is the \"only\" case where the scrollbar is useful, i.e., it would\nbe handy only once every other week, then it is better to remember that\nyou can pan around in the window by moving the mouse with the middle mouse\nbutton held down. Vertical screen estate in the commit history pane is too\nprecious to waste for a scrollbar that is useless most of the time.\n\n-- Hannes\n"},{"id":"229811","messageId":"CAMXp-VMku0eSQmmbdy-NQDedH4VSgZN5XmpTeBHvN8qX1=ersg@mail.gmail.com","threadId":"35246","inReplyTo":"5270F4FC.60900@viscovery.net","subject":"Re: [PATCH v2] gitk: Add a horizontal scrollbar for commit history","fromName":"Nicolas Cornu","fromEmail":"ncornu@aldebaran-robotics.com","sentAt":"2013-10-30T12:47:08Z","receivedAt":"2013-10-30T12:47:08Z","isPatch":true,"sender":{"key":"ncornu@aldebaran-robotics.com","avatar":null},"body":"This is useful on all our repos, every times, as we put a tag per day.\nIf the HEAD didn't move during 150 days, we got 150 tags.\nSo, it depends, maybe can I put it as an option in Edit > Preferences?\n\n2013/10/30 Johannes Sixt <j.sixt@viscovery.net>:\n> Am 10/30/2013 11:58, schrieb Nicolas Cornu:\n>> This scrollbar is not optional and is useful if there is a lot of tags or\n>> branches.\n>\n> If this is the \"only\" case where the scrollbar is useful, i.e., it would\n> be handy only once every other week, then it is better to remember that\n> you can pan around in the window by moving the mouse with the middle mouse\n> button held down. Vertical screen estate in the commit history pane is too\n> precious to waste for a scrollbar that is useless most of the time.\n>\n> -- Hannes\n"},{"id":"229814","messageId":"52711BB3.9040004@xiplink.com","threadId":"35246","inReplyTo":"CAMXp-VMku0eSQmmbdy-NQDedH4VSgZN5XmpTeBHvN8qX1=ersg@mail.gmail.com","subject":"Re: [PATCH v2] gitk: Add a horizontal scrollbar for commit history","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2013-10-30T14:46:11Z","receivedAt":"2013-10-30T14:46:11Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"On 13-10-30 08:47 AM, Nicolas Cornu wrote:\n> This is useful on all our repos, every times, as we put a tag per day.\n> If the HEAD didn't move during 150 days, we got 150 tags.\n> So, it depends, maybe can I put it as an option in Edit > Preferences?\n\nEek, even with a scrollbar, 150 tags seems like a lot to pan over.\n\nI've often thought it would be good for gitk to combine multiple ref names\ninto some kind of dropdown or view-on-hover list.  (I don't know anything\nabout Tcl/Tk, so I don't know what's feasible.)  So if a commit has more than\na couple of branches (and/or tags), only show the first branch name along\nwith a glyph indicating that there are more, and let the user click on (or\nhover over) that glyph to see all the branches (or tags -- that is, still\nkeep the tags and branches displayed separately).\n\n\t\tM.\n"},{"id":"229815","messageId":"CAMXp-VMOpBu1iUi4iQ008KyBJ5nKOpRntSSFyK+C0X8y0-J8tg@mail.gmail.com","threadId":"35246","inReplyTo":"52711BB3.9040004@xiplink.com","subject":"Re: [PATCH v2] gitk: Add a horizontal scrollbar for commit history","fromName":"Nicolas Cornu","fromEmail":"ncornu@aldebaran-robotics.com","sentAt":"2013-10-30T14:49:52Z","receivedAt":"2013-10-30T14:49:52Z","isPatch":true,"sender":{"key":"ncornu@aldebaran-robotics.com","avatar":null},"body":"2013/10/30 Marc Branchaud <marcnarc@xiplink.com>:\n> On 13-10-30 08:47 AM, Nicolas Cornu wrote:\n>> This is useful on all our repos, every times, as we put a tag per day.\n>> If the HEAD didn't move during 150 days, we got 150 tags.\n>> So, it depends, maybe can I put it as an option in Edit > Preferences?\n>\n> Eek, even with a scrollbar, 150 tags seems like a lot to pan over.\nNow, it works pretty well and is easier than mouse middle-click which\nacts strangely for me.\n>\n> I've often thought it would be good for gitk to combine multiple ref names\n> into some kind of dropdown or view-on-hover list.  (I don't know anything\n> about Tcl/Tk, so I don't know what's feasible.)  So if a commit has more than\n> a couple of branches (and/or tags), only show the first branch name along\n> with a glyph indicating that there are more, and let the user click on (or\n> hover over) that glyph to see all the branches (or tags -- that is, still\n> keep the tags and branches displayed separately).\nIt doesn't change that if you got 150 tags, when you will show them\nup, you will need to scroll.\n>\n>                 M.\n>\n"},{"id":"229816","messageId":"52712017.7080408@xiplink.com","threadId":"35246","inReplyTo":"CAMXp-VMOpBu1iUi4iQ008KyBJ5nKOpRntSSFyK+C0X8y0-J8tg@mail.gmail.com","subject":"Re: [PATCH v2] gitk: Add a horizontal scrollbar for commit history","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2013-10-30T15:04:55Z","receivedAt":"2013-10-30T15:04:55Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"On 13-10-30 10:49 AM, Nicolas Cornu wrote:\n> 2013/10/30 Marc Branchaud <marcnarc@xiplink.com>:\n>> On 13-10-30 08:47 AM, Nicolas Cornu wrote:\n>>> This is useful on all our repos, every times, as we put a tag per day.\n>>> If the HEAD didn't move during 150 days, we got 150 tags.\n>>> So, it depends, maybe can I put it as an option in Edit > Preferences?\n>>\n>> Eek, even with a scrollbar, 150 tags seems like a lot to pan over.\n>\n> Now, it works pretty well and is easier than mouse middle-click which\n> acts strangely for me.\n\nYes, it's a bit weird for me too.  I think it's because the\nmiddle-button-dragging can only be horizontal *xor* vertical.\n\n>> I've often thought it would be good for gitk to combine multiple ref names\n>> into some kind of dropdown or view-on-hover list.  (I don't know anything\n>> about Tcl/Tk, so I don't know what's feasible.)  So if a commit has more than\n>> a couple of branches (and/or tags), only show the first branch name along\n>> with a glyph indicating that there are more, and let the user click on (or\n>> hover over) that glyph to see all the branches (or tags -- that is, still\n>> keep the tags and branches displayed separately).\n>\n> It doesn't change that if you got 150 tags, when you will show them\n> up, you will need to scroll.\n\nTrue, but it would mean that there's no horizontal scroll bar taking up space\nin the main display.  The scrolling would also vertically oriented, which is\nmousewheel-friendly.  Also, the display would be a lot less cluttered.\n\n\t\tM.\n"},{"id":"229877","messageId":"20131031090526.GA9164@iris.ozlabs.ibm.com","threadId":"35246","inReplyTo":"CAMXp-VMku0eSQmmbdy-NQDedH4VSgZN5XmpTeBHvN8qX1=ersg@mail.gmail.com","subject":"Re: [PATCH v2] gitk: Add a horizontal scrollbar for commit history","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2013-10-31T09:05:26Z","receivedAt":"2013-10-31T09:05:26Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Wed, Oct 30, 2013 at 01:47:08PM +0100, Nicolas Cornu wrote:\n> This is useful on all our repos, every times, as we put a tag per day.\n> If the HEAD didn't move during 150 days, we got 150 tags.\n\nHere is a patch that I did some time ago but have never pushed out.\nDo you think it is an improvement when using gitk on a repo with lots\nof tags?\n\nPaul.\n\n[PATCH] gitk: Tag display improvements\n\nWhen a commit has many tags, the tag icons in the graph display can\neasily become so wide as to push the commit message off the right-hand\nedge of the graph display pane.  This changes the display so that if\nthere are more than 3 tags or they would take up more than a quarter\nof the width of the pane, we instead display a single tag icon with\na legend inside it like \"4 tags...\".  If the user clicks on the tag\nicon, gitk then displays all the tags in the diff display pane.\n\nSigned-off-by: Paul Mackerras <paulus@samba.org>\n---\n gitk | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------\n 1 file changed, 83 insertions(+), 13 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 5cd00d8..0bdb146 100755\n--- a/gitk\n+++ b/gitk\n@@ -2385,6 +2385,7 @@ proc makewindow {} {\n     $ctext tag conf found -back $foundbgcolor\n     $ctext tag conf currentsearchhit -back $currentsearchhitbgcolor\n     $ctext tag conf wwrap -wrap word\n+    $ctext tag conf bold -font textfontbold\n \n     .pwbottom add .bleft\n     if {!$use_ttk} {\n@@ -6387,6 +6388,25 @@ proc bindline {t id} {\n     $canv bind $t <Button-1> \"lineclick %x %y $id 1\"\n }\n \n+proc graph_pane_width {} {\n+    global use_ttk\n+\n+    if {$use_ttk} {\n+\tset g [.tf.histframe.pwclist sashpos 0]\n+    } else {\n+\tset g [.tf.histframe.pwclist sash coord 0]\n+    }\n+    return [lindex $g 0]\n+}\n+\n+proc totalwidth {l font extra} {\n+    set tot 0\n+    foreach str $l {\n+\tset tot [expr {$tot + [font measure $font $str] + $extra}]\n+    }\n+    return $tot\n+}\n+\n proc drawtags {id x xt y1} {\n     global idtags idheads idotherrefs mainhead\n     global linespc lthickness\n@@ -6398,9 +6418,27 @@ proc drawtags {id x xt y1} {\n     set marks {}\n     set ntags 0\n     set nheads 0\n+    set singletag 0\n+    set maxtags 3\n+    set maxtagpct 25\n+    set maxwidth [expr {[graph_pane_width] * $maxtagpct / 100}]\n+    set delta [expr {int(0.5 * ($linespc - $lthickness))}]\n+    set extra [expr {$delta + $lthickness + $linespc}]\n+\n     if {[info exists idtags($id)]} {\n \tset marks $idtags($id)\n \tset ntags [llength $marks]\n+\tif {$ntags > $maxtags ||\n+\t    [totalwidth $marks mainfont $extra] > $maxwidth} {\n+\t    # show just a single \"n tags...\" tag\n+\t    set singletag 1\n+\t    if {$ntags == 1} {\n+\t\tset marks [list \"tag...\"]\n+\t    } else {\n+\t\tset marks [list [format \"%d tags...\" $ntags]]\n+\t    }\n+\t    set ntags 1\n+\t}\n     }\n     if {[info exists idheads($id)]} {\n \tset marks [concat $marks $idheads($id)]\n@@ -6413,7 +6451,6 @@ proc drawtags {id x xt y1} {\n \treturn $xt\n     }\n \n-    set delta [expr {int(0.5 * ($linespc - $lthickness))}]\n     set yt [expr {$y1 - 0.5 * $linespc}]\n     set yb [expr {$yt + $linespc - 1}]\n     set xvals {}\n@@ -6428,7 +6465,7 @@ proc drawtags {id x xt y1} {\n \t}\n \tlappend xvals $xt\n \tlappend wvals $wid\n-\tset xt [expr {$xt + $delta + $wid + $lthickness + $linespc}]\n+\tset xt [expr {$xt + $wid + $extra}]\n     }\n     set t [$canv create line $x $y1 [lindex $xvals end] $y1 \\\n \t       -width $lthickness -fill $reflinecolor -tags tag.$id]\n@@ -6444,7 +6481,12 @@ proc drawtags {id x xt y1} {\n \t\t       $xr $yt $xr $yb $xl $yb $x [expr {$yb - $delta}] \\\n \t\t       -width 1 -outline $tagoutlinecolor -fill $tagbgcolor \\\n \t\t       -tags tag.$id]\n-\t    $canv bind $t <1> [list showtag $tag_quoted 1]\n+\t    if {$singletag} {\n+\t\tset tagclick [list showtags $id 1]\n+\t    } else {\n+\t\tset tagclick [list showtag $tag_quoted 1]\n+\t    }\n+\t    $canv bind $t <1> $tagclick\n \t    set rowtextx([rowofcommit $id]) [expr {$xr + $linespc}]\n \t} else {\n \t    # draw a head or other ref\n@@ -6471,7 +6513,7 @@ proc drawtags {id x xt y1} {\n \tset t [$canv create text $xl $y1 -anchor w -text $tag -fill $headfgcolor \\\n \t\t   -font $font -tags [list tag.$id text]]\n \tif {$ntags >= 0} {\n-\t    $canv bind $t <1> [list showtag $tag_quoted 1]\n+\t    $canv bind $t <1> $tagclick\n \t} elseif {$nheads >= 0} {\n \t    $canv bind $t $ctxbut [list headmenu %X %Y $id $tag_quoted]\n \t}\n@@ -10878,6 +10920,23 @@ proc listrefs {id} {\n     return [list $x $y $z]\n }\n \n+proc add_tag_ctext {tag} {\n+    global ctext cached_tagcontent tagids\n+\n+    if {![info exists cached_tagcontent($tag)]} {\n+\tcatch {\n+\t    set cached_tagcontent($tag) [exec git cat-file -p $tag]\n+\t}\n+    }\n+    $ctext insert end \"[mc \"Tag\"]: $tag\\n\" bold\n+    if {[info exists cached_tagcontent($tag)]} {\n+\tset text $cached_tagcontent($tag)\n+    } else {\n+\tset text \"[mc \"Id\"]:  $tagids($tag)\"\n+    }\n+    appendwithlinks $text {}\n+}\n+\n proc showtag {tag isnew} {\n     global ctext cached_tagcontent tagids linknum tagobjid\n \n@@ -10888,17 +10947,28 @@ proc showtag {tag isnew} {\n     clear_ctext\n     settabs 0\n     set linknum 0\n-    if {![info exists cached_tagcontent($tag)]} {\n-\tcatch {\n-           set cached_tagcontent($tag) [exec git cat-file -p $tag]\n-\t}\n+    add_tag_ctext $tag\n+    maybe_scroll_ctext 1\n+    $ctext conf -state disabled\n+    init_flist {}\n+}\n+\n+proc showtags {id isnew} {\n+    global idtags ctext linknum\n+\n+    if {$isnew} {\n+\taddtohistory [list showtags $id 0] savectextpos\n     }\n-    if {[info exists cached_tagcontent($tag)]} {\n-\tset text $cached_tagcontent($tag)\n-    } else {\n-\tset text \"[mc \"Tag\"]: $tag\\n[mc \"Id\"]:  $tagids($tag)\"\n+    $ctext conf -state normal\n+    clear_ctext\n+    settabs 0\n+    set linknum 0\n+    set sep {}\n+    foreach tag $idtags($id) {\n+\t$ctext insert end $sep\n+\tadd_tag_ctext $tag\n+\tset sep \"\\n\\n\"\n     }\n-    appendwithlinks $text {}\n     maybe_scroll_ctext 1\n     $ctext conf -state disabled\n     init_flist {}\n-- \n1.8.4.rc3\n"},{"id":"230030","messageId":"5274C89D.10103@hvoigt.net","threadId":"35246","inReplyTo":"20131031090526.GA9164@iris.ozlabs.ibm.com","subject":"Re: [PATCH v2] gitk: Add a horizontal scrollbar for commit history","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2013-11-02T09:40:45Z","receivedAt":"2013-11-02T09:40:45Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nAm 31.10.2013 10:05, schrieb Paul Mackerras:\n> On Wed, Oct 30, 2013 at 01:47:08PM +0100, Nicolas Cornu wrote:\n>> This is useful on all our repos, every times, as we put a tag per day.\n>> If the HEAD didn't move during 150 days, we got 150 tags.\n>\n> Here is a patch that I did some time ago but have never pushed out.\n> Do you think it is an improvement when using gitk on a repo with lots\n> of tags?\n>\n> Paul.\n>\n> [PATCH] gitk: Tag display improvements\n>\n> When a commit has many tags, the tag icons in the graph display can\n> easily become so wide as to push the commit message off the right-hand\n> edge of the graph display pane.  This changes the display so that if\n> there are more than 3 tags or they would take up more than a quarter\n> of the width of the pane, we instead display a single tag icon with\n> a legend inside it like \"4 tags...\".  If the user clicks on the tag\n> icon, gitk then displays all the tags in the diff display pane.\n>\n> Signed-off-by: Paul Mackerras <paulus@samba.org>\n\nYes please. I have not tried it but the description sounds great. Will \ntry to give it a testdrive next week.\n\nCheers Heiko\n"},{"id":"230077","messageId":"5277C22C.8050605@xiplink.com","threadId":"35246","inReplyTo":"20131031090526.GA9164@iris.ozlabs.ibm.com","subject":"Re: [PATCH v2] gitk: Add a horizontal scrollbar for commit history","fromName":"Marc Branchaud","fromEmail":"mbranchaud@xiplink.com","sentAt":"2013-11-04T15:50:04Z","receivedAt":"2013-11-04T15:50:04Z","isPatch":true,"sender":{"key":"mbranchaud@xiplink.com","avatar":null},"body":"On 13-10-31 05:05 AM, Paul Mackerras wrote:\n> On Wed, Oct 30, 2013 at 01:47:08PM +0100, Nicolas Cornu wrote:\n>> This is useful on all our repos, every times, as we put a tag per day.\n>> If the HEAD didn't move during 150 days, we got 150 tags.\n> \n> Here is a patch that I did some time ago but have never pushed out.\n> Do you think it is an improvement when using gitk on a repo with lots\n> of tags?\n\nI like this a lot!  Thanks for putting it together.  I think it's worth\nreleasing this as-is.\n\nMy only wish is that it be generalized for any kind of ref:  Each refs/*\nnamespace should form a distinct display category.  For example, given refs\nlike this (note the non-standard \"builds\" namespace):\n\n\trefs/heads/maint\n\trefs/heads/master\n\trefs/heads/next\n\trefs/remotes/origin/maint\n\trefs/remotes/origin/master\n\trefs/remotes/origin/next\n\trefs/remotes/origin/pu\n\trefs/tags/v1.1.1\n\trefs/tags/v2.2.2\n\trefs/tags/v3.3.3\n\trefs/tags/v4.4.4\n\trefs/builds/1.1.1-1\n\trefs/builds/1.1.1-2\n\trefs/builds/1.1.1-3\n\trefs/builds/1.1.1-4\n\trefs/builds/1.1.1-5\n\nAnd let's say that somehow all these refs refer to the same commit that's\nbeing displayed in gitk, then I'd like to see something like:\n\n\t[3 branches...][4 remote refs...][4 tags...][5 builds...]\n\nGitk can be smart about how it displays standard namespaces (as it already is\nfor tags, heads, remote heads, etc.), but for non-standard namespaces gitk\ncan just display the namespace's name directly.\n\n\t\tM.\n"}]}