« get me outta code hell

Fix tab not working in a particular case - 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>2018-08-15 16:38:54 -0300
committerFlorrie <towerofnix@gmail.com>2018-08-15 16:38:56 -0300
commitb5980abf5df2a36c59db35163c129f5b1423c4a2 (patch)
tree85b213a18df1abcc6ca0e5bbd781bda965e375c5
parentc40b45efc43f83a301531e9e0d239eaf98351f5f (diff)
Fix tab not working in a particular case
The repro:

1. Press tab to select the path element.
2. Press 2 (or 1) to switch to a different grouplike listing.
3. Press 1 (or 2) to switch back. Note that the root.select()'ed element
   is the grouplike listing's form, i.e. the list of tracks/groups, not
   the path element.
4. Press tab. Note that the root.select()'ed element does not change.

This fixes the issue by setting curIndex to 0, which is the index of the
grouplike listing's form. This makes the tab key behave correctly and
select the path element in step 4.
-rw-r--r--ui.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/ui.js b/ui.js
index befa764..ac7154d 100644
--- a/ui.js
+++ b/ui.js
@@ -733,6 +733,7 @@ class GrouplikeListingElement extends Form {
   }
 
   selected() {
+    this.curIndex = 0
     this.root.select(this.form)
   }