diff options
author | Florrie <towerofnix@gmail.com> | 2019-01-31 21:53:25 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-01-31 21:53:25 -0400 |
commit | d711299b5ac4b7ea6954d1f766acfeb369e181c1 (patch) | |
tree | b22e8478b35ab2c6d9cc4cbca4d4917adc2f71b1 | |
parent | 82bbf5ca046323640c5de332bc33f2b5ae5f8efc (diff) |
More hacky layout stuff
Fixes play/mark/etc status not updating right away.
-rw-r--r-- | ui.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ui.js b/ui.js index c86c8ad..6acebc7 100644 --- a/ui.js +++ b/ui.js @@ -1249,7 +1249,8 @@ class BasicGrouplikeItemElement extends Button { for (const char of characters) { if (heckingWatchOut) { - if (ansi.measureColumns(text + char) <= this.w - this.x) { + // 3 = width of status line, basically + if (ansi.measureColumns(text + char) + 3 <= this.w - this.x) { text += char } else { done = true @@ -1262,18 +1263,15 @@ class BasicGrouplikeItemElement extends Button { } } - this.drawX = this.x - this.writeStatus(writable) - // This is the part where we want to be careful to not go over the width // limit.. heckingWatchOut = true writable.write(this.text) - this.drawX += ansi.measureColumns(this.text) heckingWatchOut = false - writable.write(' '.repeat(Math.max(0, this.w - this.drawX))) - + const width = ansi.measureColumns(this.text) + // again, 3 = width of status bar + writable.write(' '.repeat(Math.max(0, this.w - width - 3))) writable.write(ansi.resetAttributes()) this.drawText = text @@ -1294,6 +1292,7 @@ class BasicGrouplikeItemElement extends Button { } writable.write(ansi.moveCursor(this.absTop, this.absLeft)) + this.writeStatus(writable) writable.write(this.drawText) } |