« 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--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)
     }