« 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--todo.txt5
-rw-r--r--ui.js11
2 files changed, 15 insertions, 1 deletions
diff --git a/todo.txt b/todo.txt
index 36eeb05..869b051 100644
--- a/todo.txt
+++ b/todo.txt
@@ -125,3 +125,8 @@ TODO: Entering more than one key "at once" into a text input element will only
       text. (This is an issue when pasting or spamming the keyboard.) Should be
       fixed in tui-lib.
       (Done!)
+
+TODO: Pressing space while an "Up (to <group>)" button is selected both
+      activates the button and pauses music (because the app detects that the
+      space key is pressed). This is definitely wrong (it should do one or the
+      other - I'm not too sure which, yet, but probably the latter).
diff --git a/ui.js b/ui.js
index 1d8d2da..73a9732 100644
--- a/ui.js
+++ b/ui.js
@@ -949,8 +949,17 @@ class GrouplikeItemElement extends Button {
   }
 
   drawTo(writable) {
-    if (this.isSelected) {
+    const isCurrentInput = this.parent.inputs[this.parent.curIndex] === this
+    // This line's commented out for now, so it'll show as selected (but
+    // dimmed) even if you don't have the listing selected. To change that,
+    // uncomment this and add it to the isCurrentInput line.
+    // const isListingSelected = this.parent.parent.isSelected
+    const isSelfSelected = this.isSelected
+
+    if (isSelfSelected) {
       writable.write(ansi.invert())
+    } else if (isCurrentInput) {
+      writable.write(ansi.setAttributes([ansi.A_INVERT, ansi.A_DIM]))
     }
 
     writable.write(ansi.moveCursor(this.absTop, this.absLeft))