1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

Change shift+pgup/pgdown to scroll history

The default shift+pgup/pgdown buttons were sending the escape sequences
specified by the official standard, however most terminal emulators like
XTerm, URxvt and VTE make an exception for this special case and instead
scroll the native history buffer.

Both XTerm and URxvt do never send the escapes for Shift+PgUp/PgDown,
however VTE does send them in the alternate screen.

Since Alacritty already supports keybindings based on terminal mode and
the binding to scroll the history is useless when in the alternate
screen buffer, Alacritty is now following VTEs behavior here, allowing
applications in the alt screen (like vim) to handle this escape.

Fixes #1989.
This commit is contained in:
Christian Duerr 2019-02-08 01:46:56 +00:00 committed by GitHub
parent 35efb4619c
commit 153f9257b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 125 additions and 118 deletions

View file

@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Error/Warning bar doesn't overwrite the terminal anymore
- Full error/warning messages are displayed
- Config error messages are automatically removed when the config is fixed
- Scroll history on Shift+PgUp/PgDown when scrollback history is available
### Fixed

View file

@ -471,10 +471,12 @@ key_bindings:
- { key: Home, chars: "\x1b[H", mode: ~AppCursor }
- { key: End, chars: "\x1bOF", mode: AppCursor }
- { key: End, chars: "\x1b[F", mode: ~AppCursor }
- { key: PageUp, mods: Shift, chars: "\x1b[5;2~" }
- { key: PageUp, mods: Shift, action: ScrollPageUp, mode: ~Alt }
- { key: PageUp, mods: Shift, chars: "\x1b[5;2~", mode: Alt }
- { key: PageUp, mods: Control, chars: "\x1b[5;5~" }
- { key: PageUp, chars: "\x1b[5~" }
- { key: PageDown, mods: Shift, chars: "\x1b[6;2~" }
- { key: PageDown, mods: Shift, action: ScrollPageDown, mode: ~Alt }
- { key: PageDown, mods: Shift, chars: "\x1b[6;2~", mode: Alt }
- { key: PageDown, mods: Control, chars: "\x1b[6;5~" }
- { key: PageDown, chars: "\x1b[6~" }
- { key: Tab, mods: Shift, chars: "\x1b[Z" }

View file

@ -72,10 +72,12 @@ pub fn default_key_bindings() -> Vec<KeyBinding> {
Key::Home, ~TermMode::APP_CURSOR; Action::Esc("\x1b[H".into());
Key::End, +TermMode::APP_CURSOR; Action::Esc("\x1bOF".into());
Key::End, ~TermMode::APP_CURSOR; Action::Esc("\x1b[F".into());
Key::PageUp, [shift: true]; Action::Esc("\x1b[5;2~".into());
Key::PageUp, [shift: true], ~TermMode::ALT_SCREEN; Action::ScrollPageUp;
Key::PageUp, [shift: true], +TermMode::ALT_SCREEN; Action::Esc("\x1b[5;2~".into());
Key::PageUp, [ctrl: true]; Action::Esc("\x1b[5;5~".into());
Key::PageUp; Action::Esc("\x1b[5~".into());
Key::PageDown, [shift: true]; Action::Esc("\x1b[6;2~".into());
Key::PageDown, [shift: true], ~TermMode::ALT_SCREEN; Action::ScrollPageDown;
Key::PageDown, [shift: true], +TermMode::ALT_SCREEN; Action::Esc("\x1b[6;2~".into());
Key::PageDown, [ctrl: true]; Action::Esc("\x1b[6;5~".into());
Key::PageDown; Action::Esc("\x1b[6~".into());
Key::Tab, [shift: true]; Action::Esc("\x1b[Z".into());

View file

@ -937,6 +937,8 @@ impl<'a> de::Deserialize<'a> for ModeWrapper {
"~AppCursor" => res.not_mode |= mode::TermMode::APP_CURSOR,
"AppKeypad" => res.mode |= mode::TermMode::APP_KEYPAD,
"~AppKeypad" => res.not_mode |= mode::TermMode::APP_KEYPAD,
"~Alt" => res.not_mode |= mode::TermMode::ALT_SCREEN,
"Alt" => res.mode |= mode::TermMode::ALT_SCREEN,
_ => error!("Unknown mode {:?}", modifier),
}
}