From d711299b5ac4b7ea6954d1f766acfeb369e181c1 Mon Sep 17 00:00:00 2001 From: Florrie Date: Thu, 31 Jan 2019 21:53:25 -0400 Subject: More hacky layout stuff Fixes play/mark/etc status not updating right away. --- ui.js | 13 ++++++------- 1 file 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) } -- cgit 1.3.0-6-gf8a5