From: Michael Haggerty <mhagger@alum.mit.edu>
To: Paul Mackerras <paulus@samba.org>
Cc: git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCH 09/13] gitk: shorten labels displayed for modern remote-tracking refs
Date: Mon, 19 Dec 2016 17:45:08 +0100 [thread overview]
Message-ID: <5dec4a22621a441099b187f081831bbe8f5cc05c.1482164633.git.mhagger@alum.mit.edu> (raw)
In-Reply-To: <cover.1482164633.git.mhagger@alum.mit.edu>
If a reference has the form
refs/remotes/origin/foo
, then use the label
origin/foo
^^^^^^^
, where the indicated part is displayed in `$remotebgcolor`. The old
code would have displayed such a reference as
remotes/origin/foo
^^^^^^^^^^^^^^^
, which wastes horizontal space displaying `remote/` for every remote
reference. However, if a remote-tracking reference has only two slashes,
like
refs/remotes/baz
, render the label the same as before, namely
remotes/baz
^^^^^^^^
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
gitk | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/gitk b/gitk
index c146a15..d22ce5f 100755
--- a/gitk
+++ b/gitk
@@ -6558,7 +6558,9 @@ proc remotereftext {head textName prefixName} {
upvar $textName text
upvar $prefixName prefix
- if {[regexp {^((remotes/([^/]+/|)).*)} $head match text prefix]} {
+ if {[regexp {^remotes/(([^/]+/).*)} $head match text prefix]} {
+ return 1
+ } elseif {[regexp {^((remotes/).*)} $head match text prefix]} {
return 1
} else {
set text $head
@@ -6613,7 +6615,8 @@ proc drawtags {id x xt y1} {
lappend wvals [font measure mainfontbold $head]
} else {
lappend types head
- lappend wvals [font measure mainfont $head]
+ remotereftext $head text remoteprefix
+ lappend wvals [font measure mainfont $text]
}
lappend marks $head
}
@@ -6644,6 +6647,7 @@ proc drawtags {id x xt y1} {
set xl [expr {$x + $delta}]
set xr [expr {$x + $delta + $wid + $lthickness}]
set font mainfont
+ set text $tag
if {$type eq "tag" || $type eq "tags"} {
# draw a tag
set t [$canv create polygon $x [expr {$yt + $delta}] $xl $yt \
@@ -6679,7 +6683,7 @@ proc drawtags {id x xt y1} {
-width 0 -fill $remotebgcolor -tags tag.$id
}
}
- set t [$canv create text $xl $y1 -anchor w -text $tag -fill $headfgcolor \
+ set t [$canv create text $xl $y1 -anchor w -text $text -fill $headfgcolor \
-font $font -tags [list tag.$id text]]
if {$type eq "tag" || $type eq "tags"} {
$canv bind $t <1> $tagclick
--
2.9.3
next prev parent reply other threads:[~2016-12-19 16:50 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 16:44 [PATCH 00/13] gitk: tweak rendering of remote-tracking references Michael Haggerty
2016-12-19 16:45 ` [PATCH 01/13] gitk: when processing tag labels, don't use `marks` as scratch space Michael Haggerty
2016-12-19 16:45 ` [PATCH 02/13] gitk: keep track of tag types in a separate `types` array Michael Haggerty
2016-12-19 16:45 ` [PATCH 03/13] gitk: use a type "tags" to indicate abbreviated tags Michael Haggerty
2016-12-19 16:45 ` [PATCH 04/13] gitk: use a type "mainhead" to indicate the main HEAD branch Michael Haggerty
2016-12-19 16:45 ` [PATCH 05/13] gitk: fill in `wvals` as the tags are first processed Michael Haggerty
2016-12-19 16:45 ` [PATCH 06/13] gitk: simplify regexp Michael Haggerty
2016-12-19 16:45 ` [PATCH 07/13] gitk: extract a method `remotereftext` Michael Haggerty
2016-12-19 16:45 ` [PATCH 08/13] gitk: only change the color of the "remote" part of remote refs Michael Haggerty
2016-12-19 16:45 ` Michael Haggerty [this message]
2016-12-19 16:45 ` [PATCH 10/13] gitk: use type "remote" for remote-tracking references Michael Haggerty
2016-12-19 16:45 ` [PATCH 11/13] gitk: introduce a constant otherrefbgcolor Michael Haggerty
2016-12-19 16:45 ` [PATCH 12/13] gitk: add a configuration setting `remoterefbgcolor` Michael Haggerty
2016-12-19 16:45 ` [PATCH 13/13] gitk: change the default colors for remote-tracking references Michael Haggerty
2016-12-19 22:53 ` [PATCH 00/13] gitk: tweak rendering of " Philip Oakley
2016-12-20 8:03 ` Michael Haggerty
2016-12-20 15:01 ` Marc Branchaud
2016-12-20 22:17 ` Paul Mackerras
2016-12-20 22:53 ` Marc Branchaud
2016-12-21 0:05 ` Michael Haggerty
2016-12-21 19:07 ` Marc Branchaud
2016-12-22 8:15 ` Michael Haggerty
2017-01-09 22:03 ` Marc Branchaud
2017-02-06 17:13 ` Marc Branchaud
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5dec4a22621a441099b187f081831bbe8f5cc05c.1482164633.git.mhagger@alum.mit.edu \
--to=mhagger@alum.mit.edu \
--cc=git@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).