« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/ui.js b/ui.js
index f333b7a..0499ff6 100644
--- a/ui.js
+++ b/ui.js
@@ -3836,12 +3836,16 @@ class ContextMenu extends FocusElement {
     let wantDivider = false
     const addDividerIfWanted = () => {
       if (wantDivider) {
-        const element = new HorizontalRule()
-        this.form.addInput(element)
+        if (!firstItem) {
+          const element = new HorizontalRule()
+          this.form.addInput(element)
+        }
         wantDivider = false
       }
     }
 
+    let firstItem = true
+
     const keyElementMap = {}
 
     for (const item of items.filter(Boolean)) {
@@ -3854,6 +3858,7 @@ class ContextMenu extends FocusElement {
         if (item.isDefault) {
           this.root.select(item.element)
         }
+        firstItem = false
       } else if (item.divider) {
         wantDivider = true
       } else {
@@ -3875,6 +3880,7 @@ class ContextMenu extends FocusElement {
         if (item.isDefault) {
           this.root.select(button)
         }
+        firstItem = false
       }
       if (item.key) {
         keyElementMap[item.key] = focusEl