1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2025-07-31 22:03:40 -04:00

Add ScrollLineUp and ScrollLineDown actions for scrolling line by line

This commit is contained in:
Jerry Yin 2019-04-08 12:50:06 -07:00 committed by Christian Duerr
parent 6757acbb82
commit 090842bd8e
4 changed files with 20 additions and 2 deletions

View file

@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added the ability to change the selection color - Added the ability to change the selection color
- Text will reflow instead of truncating when resizing Alacritty - Text will reflow instead of truncating when resizing Alacritty
- Underline text and change cursor when hovering over URLs with required modifiers pressed - Underline text and change cursor when hovering over URLs with required modifiers pressed
- Added ScrollLineUp and ScrollLineDown actions for scrolling line by line
### Changed ### Changed

View file

@ -438,6 +438,8 @@ alt_send_esc: true
# - ResetFontSize # - ResetFontSize
# - ScrollPageUp # - ScrollPageUp
# - ScrollPageDown # - ScrollPageDown
# - ScrollLineUp
# - ScrollLineDown
# - ScrollToTop # - ScrollToTop
# - ScrollToBottom # - ScrollToBottom
# - ClearHistory # - ClearHistory

View file

@ -868,8 +868,9 @@ impl<'a> de::Deserialize<'a> for ActionWrapper {
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str( f.write_str(
"Paste, Copy, PasteSelection, IncreaseFontSize, DecreaseFontSize, \ "Paste, Copy, PasteSelection, IncreaseFontSize, DecreaseFontSize, \
ResetFontSize, ScrollPageUp, ScrollPageDown, ScrollToTop, ScrollToBottom, \ ResetFontSize, ScrollPageUp, ScrollPageDown, ScrollLineUp, ScrollLineDown, \
ClearHistory, Hide, ClearLogNotice, SpawnNewInstance, None or Quit", ScrollToTop, ScrollToBottom, ClearHistory, Hide, ClearLogNotice, \
SpawnNewInstance, None or Quit",
) )
} }
@ -886,6 +887,8 @@ impl<'a> de::Deserialize<'a> for ActionWrapper {
"ResetFontSize" => Action::ResetFontSize, "ResetFontSize" => Action::ResetFontSize,
"ScrollPageUp" => Action::ScrollPageUp, "ScrollPageUp" => Action::ScrollPageUp,
"ScrollPageDown" => Action::ScrollPageDown, "ScrollPageDown" => Action::ScrollPageDown,
"ScrollLineUp" => Action::ScrollLineUp,
"ScrollLineDown" => Action::ScrollLineDown,
"ScrollToTop" => Action::ScrollToTop, "ScrollToTop" => Action::ScrollToTop,
"ScrollToBottom" => Action::ScrollToBottom, "ScrollToBottom" => Action::ScrollToBottom,
"ClearHistory" => Action::ClearHistory, "ClearHistory" => Action::ClearHistory,

View file

@ -220,6 +220,12 @@ pub enum Action {
/// Scroll exactly one page down /// Scroll exactly one page down
ScrollPageDown, ScrollPageDown,
/// Scroll one line up
ScrollLineUp,
/// Scroll one line down
ScrollLineDown,
/// Scroll all the way to the top /// Scroll all the way to the top
ScrollToTop, ScrollToTop,
@ -317,6 +323,12 @@ impl Action {
Action::ScrollPageDown => { Action::ScrollPageDown => {
ctx.scroll(Scroll::PageDown); ctx.scroll(Scroll::PageDown);
}, },
Action::ScrollLineUp => {
ctx.scroll(Scroll::Lines(1));
},
Action::ScrollLineDown => {
ctx.scroll(Scroll::Lines(-1));
},
Action::ScrollToTop => { Action::ScrollToTop => {
ctx.scroll(Scroll::Top); ctx.scroll(Scroll::Top);
}, },