[PATCH GITK 3/6] gitk: drawtags: Introduce concept of unabbreviated marks
- From
- Ian Jackson <ijackson@chiark.greenend.org.uk>
- Date
- Nov 8, 2016, 00:52 UTC
- Message-ID
- <20161108005241.19888-4-ijackson@chiark.greenend.org.uk>
- In-Reply-To
- <20161108005241.19888-1-ijackson@chiark.greenend.org.uk>
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 <ijackson@chiark.greenend.org.uk> --- 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