« get me outta code hell

(g), (G) to select first, last item in listings - 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-12-28 20:14:31 -0400
committerFlorrie <towerofnix@gmail.com>2018-12-28 20:14:31 -0400
commitaabdddbbf7092c83369b77617ce5eb2b7af3dde8 (patch)
treef9663cfc75e2209c90640fef068049ce09970c81
parent0d0a8ab505f670cb0df3bf403b919c55463d9a1c (diff)
(g), (G) to select first, last item in listings
-rw-r--r--README.md1
-rw-r--r--ui.js5
2 files changed, 6 insertions, 0 deletions
diff --git a/README.md b/README.md
index c59f80b..379db82 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@ You're also welcome to share any ideas, suggestions, and questions through there
 * <kbd><kbd>Ctrl</kbd>+<kbd>C</kbd></kbd> - exit
 * <kbd>Up</kbd> and <kbd>Down</kbd> - select previous or next item in a listing
 * <kbd>Tab</kbd> and <kbd><kbd>Shift</kbd>+<kbd>Tab</kbd></kbd> - switch between UI elements
+* <kbd>g</kbd> and <kbd>G</kbd> - move to the first and last item in a listing
 * <kbd>1</kbd> - focus the main track/group listing
 * <kbd>2</kbd> - focus the queue listing
 * <kbd>Enter</kbd> - play the selected track
diff --git a/ui.js b/ui.js
index 43c72bc..7013ea5 100644
--- a/ui.js
+++ b/ui.js
@@ -938,6 +938,11 @@ class GrouplikeListingElement extends Form {
       this.loadParentGrouplike()
     } else if (telc.isCharacter(keyBuf, '/') || keyBuf[0] === 6) { // '/', ctrl-F
       this.showJumpElement()
+    } else if (telc.isCharacter(keyBuf, 'g')) {
+      this.form.selectAndShow(this.grouplike.items[0])
+      this.form.scrollToBeginning()
+    } else if (telc.isCharacter(keyBuf, 'G')) {
+      this.form.selectAndShow(this.grouplike.items[this.grouplike.items.length - 1])
     } else {
       return super.keyPressed(keyBuf)
     }