Skip to content

Commit

Permalink
bind g/G to go to the top/bottom of the queue
Browse files Browse the repository at this point in the history
  • Loading branch information
figsoda committed Jan 15, 2021
1 parent 8ea704c commit 807d98f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Key | Action
<kbd>k</kbd>, <kbd>Up</kbd> or <kbd>ScrollUp</kbd> | go up in the queue
<kbd>J</kbd> or <kbd>PageDown</kbd> | jump down in the queue
<kbd>K</kbd> or <kbd>PageUp</kbd> | jump up in the queue
<kbd>g</kbd> | go to the top of the queue
<kbd>G</kbd> | go to the bottom of the queue
<kbd>/</kbd> | enter searching mode
<kbd>Escape</kbd> | quit searching mode and empty query

Expand Down
2 changes: 2 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ pub enum Command {
Up,
JumpDown,
JumpUp,
GotoTop,
GotoBottom,
InputSearch(char),
BackspaceSearch,
QuitSearch,
Expand Down
14 changes: 14 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ async fn run() -> Result<()> {
'k' => Command::Up,
'J' => Command::JumpDown,
'K' => Command::JumpUp,
'g' => Command::GotoTop,
'G' => Command::GotoBottom,
'/' => {
searching = true;
Command::Searching(true)
Expand Down Expand Up @@ -417,6 +419,18 @@ async fn run() -> Result<()> {
};
0b001
}
Command::GotoTop => {
s.select(0);
0b001
}
Command::GotoBottom => {
let len = s.len();
if len == 0 {
continue;
}
s.select(len - 1);
0b001
}
Command::InputSearch(c) => {
if s.query.is_empty() {
s.query.push(c);
Expand Down

0 comments on commit 807d98f

Please sign in to comment.