diff --git a/CHANGELOG.md b/CHANGELOG.md index 217d3baa..ecd7770b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,5 @@ # unreleased -- Fixed bug caused by using `--plain` and `--terminal-width=N` flags simultaneously, see #3529 (@H4k1l) -- Fixed syntax tests path, see #3610 (@foxfromworld) ## Features @@ -28,11 +26,13 @@ - `--help` now correctly honors `--pager=builtin`. See #3516 (@keith-hall) - `--help` now correctly honors custom themes. See #3524 (@keith-hall) - Fixed test compatibility with future Cargo build directory changes, see #3550 (@nmacl) +- Fixed bug caused by using `--plain` and `--terminal-width=N` flags simultaneously, see #3529 (@H4k1l) +- Fixed syntax tests path, see #3610 (@foxfromworld) ## Other - Use git version of cross. See #3533 (@OctopusET) - - Bump MSRV to 1.88, update `time` crate to 0.3.47 to fix RUSTSEC-2026-0009, see #3581 (@NORMAL-EX) +- Allow home and end keys to be used with builtin pager, see #3651 (@keith-hall) ## Syntaxes diff --git a/src/output.rs b/src/output.rs index 0205f48e..8054be46 100644 --- a/src/output.rs +++ b/src/output.rs @@ -23,6 +23,18 @@ pub struct BuiltinPager { impl BuiltinPager { fn new() -> Self { let pager = minus::Pager::new(); + + let mut input_register = minus::input::HashedEventRegister::default(); + input_register.add_key_events(&["home"], |_, _| { + minus::input::InputEvent::UpdateUpperMark(0) + }); + input_register.add_key_events(&["end"], |_, _| { + minus::input::InputEvent::UpdateUpperMark(usize::MAX) + }); + pager + .set_input_classifier(Box::new(input_register)) + .expect("failed to set input classifier on newly created pager"); + let handle = { let pager = pager.clone(); Some(spawn(move || {