From cddda96a4622225caee1e889524876c02ab97c87 Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 9 Jul 2019 18:12:10 -0300 Subject: Always display at least part of group name ...in PathElements. Particularly, in the queue listing, which is often too thin to display even a single group name. --- ui.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'ui.js') diff --git a/ui.js b/ui.js index 378cd77..7cc55e2 100644 --- a/ui.js +++ b/ui.js @@ -2068,8 +2068,21 @@ class PathItemElement extends FocusElement { } fixLayout() { - this.button.fixLayout() + const text = this.item.name || '(Unnamed)' + + const maxWidth = this.parent ? this.parent.contentW : Infinity this.arrowLabel.fixLayout() + + const maxButtonWidth = maxWidth - this.arrowLabel.w + + if (text.length > maxButtonWidth) { + this.button.text = unic.ELLIPSIS + text.slice(-(maxButtonWidth - 1)) + } else { + this.button.text = text + } + + this.button.fixLayout() + this.w = this.button.w + this.arrowLabel.w this.button.x = this.arrowLabel.right this.h = 1 -- cgit 1.3.0-6-gf8a5