summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerry Yin <enjmiah@users.noreply.github.com>2019-04-08 12:50:06 -0700
committerChristian Duerr <chrisduerr@users.noreply.github.com>2019-04-08 19:50:06 +0000
commit090842bd8e8890c40cf40a4430bae1b073515c40 (patch)
tree1afb5090a7ef07d14fd3d284e96d6c78d966a3a6
parent6757acbb824e8be9968529a66e9a75a0a2ea2f5d (diff)
Add ScrollLineUp and ScrollLineDown actions for scrolling line by line
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty.yml2
-rw-r--r--src/config/mod.rs7
-rw-r--r--src/input.rs12
4 files changed, 20 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bc2fd12c..edbae1b3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
- Text will reflow instead of truncating when resizing Alacritty
- Underline text and change cursor when hovering over URLs with required modifiers pressed
+- Added ScrollLineUp and ScrollLineDown actions for scrolling line by line
### Changed
diff --git a/alacritty.yml b/alacritty.yml
index b35867c2..d8044281 100644
--- a/alacritty.yml
+++ b/alacritty.yml
@@ -438,6 +438,8 @@ alt_send_esc: true
# - ResetFontSize
# - ScrollPageUp
# - ScrollPageDown
+# - ScrollLineUp
+# - ScrollLineDown
# - ScrollToTop
# - ScrollToBottom
# - ClearHistory
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 94e74e41..14ebc87d 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -868,8 +868,9 @@ impl<'a> de::Deserialize<'a> for ActionWrapper {
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(
"Paste, Copy, PasteSelection, IncreaseFontSize, DecreaseFontSize, \
- ResetFontSize, ScrollPageUp, ScrollPageDown, ScrollToTop, ScrollToBottom, \
- ClearHistory, Hide, ClearLogNotice, SpawnNewInstance, None or Quit",
+ ResetFontSize, ScrollPageUp, ScrollPageDown, ScrollLineUp, ScrollLineDown, \
+ ScrollToTop, ScrollToBottom, ClearHistory, Hide, ClearLogNotice, \
+ SpawnNewInstance, None or Quit",
)
}
@@ -886,6 +887,8 @@ impl<'a> de::Deserialize<'a> for ActionWrapper {
"ResetFontSize" => Action::ResetFontSize,
"ScrollPageUp" => Action::ScrollPageUp,
"ScrollPageDown" => Action::ScrollPageDown,
+ "ScrollLineUp" => Action::ScrollLineUp,
+ "ScrollLineDown" => Action::ScrollLineDown,
"ScrollToTop" => Action::ScrollToTop,
"ScrollToBottom" => Action::ScrollToBottom,
"ClearHistory" => Action::ClearHistory,
diff --git a/src/input.rs b/src/input.rs
index 8ce8f2cd..9619ffa7 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -220,6 +220,12 @@ pub enum Action {
/// Scroll exactly one page down
ScrollPageDown,
+ /// Scroll one line up
+ ScrollLineUp,
+
+ /// Scroll one line down
+ ScrollLineDown,
+
/// Scroll all the way to the top
ScrollToTop,
@@ -317,6 +323,12 @@ impl Action {
Action::ScrollPageDown => {
ctx.scroll(Scroll::PageDown);
},
+ Action::ScrollLineUp => {
+ ctx.scroll(Scroll::Lines(1));
+ },
+ Action::ScrollLineDown => {
+ ctx.scroll(Scroll::Lines(-1));
+ },
Action::ScrollToTop => {
ctx.scroll(Scroll::Top);
},