diff options
author | Florrie <towerofnix@gmail.com> | 2019-07-09 18:12:10 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-07-09 18:12:10 -0300 |
commit | cddda96a4622225caee1e889524876c02ab97c87 (patch) | |
tree | f5d3bde0d52e9a9a9094231c6d2c2c1cd952a7d0 | |
parent | a0d5dfcd12b27811dad61b2fea5b73c359f54cf5 (diff) |
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.
-rw-r--r-- | ui.js | 15 |
1 files changed, 14 insertions, 1 deletions
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 |