« get me outta code hell

Clean up remove event code - 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-07-30 19:21:53 -0300
committerFlorrie <towerofnix@gmail.com>2018-07-30 19:21:53 -0300
commitaf3894b99868e8fabe9e2f0c640184f952e216a2 (patch)
treeaaf7940660c581d2135f5bf0d9c96c9ca55ab064
parentc5c245f74deac6f226d70ca5351cc7cfbaa8e474 (diff)
Clean up remove event code
-rw-r--r--README.md2
-rw-r--r--ui.js11
2 files changed, 5 insertions, 8 deletions
diff --git a/README.md b/README.md
index 77886b8..7f6a10c 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ playlist.json file (usually generated by http-music or downloaded from online).
 * **In the queue listing:**
   * <kbd>s</kbd> - shuffle the queue
   * <kbd>c</kbd> - clear the queue
-  * <kbd>Backspace</kbd> - remove the selected track from the queue
+  * <kbd>x</kbd> - remove the selected track from the queue
 * **In path displays:** (Path displays are the things that show below the main and queue listings. They show the path of groups to the selected item in the listing.)
   * <kbd>Enter</kbd> or <kbd>Space</kbd> - view the selected item in the main listing
   * <kbd>Left</kbd> and <kbd>Right</kbd> - navigate the path display
diff --git a/ui.js b/ui.js
index 5302c7c..1c673a5 100644
--- a/ui.js
+++ b/ui.js
@@ -62,8 +62,7 @@ class AppElement extends FocusElement {
     this.form.addInput(this.queueListingElement, false)
 
     this.queueListingElement.on('queue', item => this.playGrouplikeItem(item))
-    this.queueListingElement.on('remove (backspace)', item => this.unqueueGrouplikeItem(item))
-    this.queueListingElement.on('remove (x)', item => this.unqueueGrouplikeItem(item))
+    this.queueListingElement.on('remove', item => this.unqueueGrouplikeItem(item))
     this.queueListingElement.on('shuffle', () => this.shuffleQueue())
     this.queueListingElement.on('clear', () => this.clearQueue())
     this.queueListingElement.on('select main listing',
@@ -135,7 +134,7 @@ class AppElement extends FocusElement {
       }
     }
 
-    grouplikeListing.on('remove (x)', item => {
+    grouplikeListing.on('remove', item => {
       if (this.editMode) {
         const parent = item[parentSymbol]
         const index = parent.items.indexOf(item)
@@ -756,7 +755,7 @@ class GrouplikeListingElement extends FocusElement {
     if (this.grouplike.items.length) {
       for (const item of this.grouplike.items) {
         const itemElement = new GrouplikeItemElement(item, this.recordStore)
-        for (const evtName of ['download', 'remove (backspace)', 'remove (x)', 'mark', 'browse', 'queue', 'menu']) {
+        for (const evtName of ['download', 'remove', 'mark', 'browse', 'queue', 'menu']) {
           itemElement.on(evtName, (...data) => this.emit(evtName, item, ...data))
         }
         form.addInput(itemElement)
@@ -932,10 +931,8 @@ class GrouplikeItemElement extends Button {
       } else {
         this.emit('queue', {where: 'next', play: true})
       }
-    } else if (telc.isBackspace(keyBuf)) {
-      this.emit('remove (backspace)')
     } else if (telc.isCaselessLetter(keyBuf, 'x')) {
-      this.emit('remove (x)')
+      this.emit('remove')
     /*
     } else if (telc.isCaselessLetter(keyBuf, 'm')) {
       this.emit('mark')