Thread (13 messages) flat view 13 messages, 4 authors, 2016-11-09
STALE3570d

[PATCH GITK 3/6] gitk: drawtags: Introduce concept of unabbreviated marks

From: Ian Jackson <hidden>
Date: 2016-11-08 00:53:16
Subsystem: the rest · Maintainer: Linus Torvalds

We are going to want to show some tags in full, even if they are long
or there are other tags.  Do this by filtering the tags into
`marks_unabbrev' and `marks'.  `marks_unabbrev' bypasses the tag
abbreviation, and is put on the front of the marks array after any
abbreviation has been done.

No functional change right now because no tags are considered
`unabbrev'.

Signed-off-by: Ian Jackson <redacted>
---
 gitk | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/gitk b/gitk
index 31aecda..d76f1e3 100755
--- a/gitk
+++ b/gitk
@@ -6546,6 +6546,10 @@ proc totalwidth {l font extra} {
     return $tot
 }
 
+proc tag_want_unabbrev {tag} {
+    return 0
+}
+
 proc drawtags {id x xt y1} {
     global idtags idheads idotherrefs mainhead
     global linespc lthickness
@@ -6564,8 +6568,16 @@ proc drawtags {id x xt y1} {
     set delta [expr {int(0.5 * ($linespc - $lthickness))}]
     set extra [expr {$delta + $lthickness + $linespc}]
 
+    set marks_unabbrev {}
     if {[info exists idtags($id)]} {
-	set marks $idtags($id)
+	set marks {}
+	foreach tag $idtags($id) {
+	    if {[tag_want_unabbrev $tag]} {
+		lappend marks_unabbrev $tag
+	    } else {
+		lappend marks $tag
+	    }
+	}
 	set ntags [llength $marks]
 	if {$ntags > $maxtags ||
 	    [totalwidth $marks mainfont $extra] > $maxwidth} {
@@ -6577,6 +6589,7 @@ proc drawtags {id x xt y1} {
 	    }
 	}
     }
+    set marks [concat $marks_unabbrev $marks]
     set ntags [llength $marks]
 
     if {[info exists idheads($id)]} {
-- 
2.10.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help