Skip to content

Handle ^F, ^B, ^U and ^D readline shortcuts in pager #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions objdiff-cli/src/cmd/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,22 @@ pub fn run(args: Args) -> Result<()> {
skip += per_page;
redraw = true;
}
KeyCode::Char('f') if event.modifiers.contains(KeyModifiers::CONTROL) => {

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemed simplest this way, unless we want to be able to map ctrl-alt-f to something. Based on some testing with less, ctrl-shift-f seems to also trigger a page down.

skip += per_page;
redraw = true;
}
KeyCode::Char('b') if event.modifiers.contains(KeyModifiers::CONTROL) => {
skip = skip.saturating_sub(per_page);
redraw = true;
}
KeyCode::Char('d') if event.modifiers.contains(KeyModifiers::CONTROL) => {
skip += per_page / 2;
redraw = true;
}
KeyCode::Char('u') if event.modifiers.contains(KeyModifiers::CONTROL) => {
skip = skip.saturating_sub(per_page / 2);
redraw = true;
}
// Scroll down
KeyCode::Down | KeyCode::Char('j') => {
skip += 1;
Expand Down