« get me outta code hell

Fix layouting of context menus with scrollbars - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-07-18 23:29:23 -0300
committerFlorrie <towerofnix@gmail.com>2019-07-18 23:29:23 -0300
commit0424c49035d35d9bc8ec9c64e834ff9fefd2d1ad (patch)
treeeeb3def18fb301a5227bde9d95ad6402576740e3
parentfa36c81f256a7b357cc64b42129a119d3c98b056 (diff)
Fix layouting of context menus with scrollbars
-rw-r--r--ui.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/ui.js b/ui.js
index c8d5363..a19c82d 100644
--- a/ui.js
+++ b/ui.js
@@ -2638,7 +2638,7 @@ class ContextMenu extends FocusElement {
 
     width += 2 // Space for the pane border
     height += 2 // Space for the pane border
-    if (this.form.scrollBarVisible) width++
+    if (this.form.scrollBarShown) width++
     this.w = width
     this.h = height
 
@@ -2646,6 +2646,7 @@ class ContextMenu extends FocusElement {
 
     this.pane.fillParent()
     this.form.fillParent()
+    this.form.fixLayout()
 
     // After everything else, do a second pass to apply the decided width
     // to every element, so that they expand to all be the same width.
@@ -2655,7 +2656,7 @@ class ContextMenu extends FocusElement {
       input.fixLayout()
       if (input.text) {
         const inputWidth = ansi.measureColumns(input.text)
-        if (inputWidth < width) {
+        if (inputWidth < this.form.contentW) {
           input.text += ' '.repeat(this.form.contentW - inputWidth)
         }
       }