From 27b551d34593cd94a3fba016c3a7f2042f9d9d38 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Tue, 10 Aug 2021 08:35:20 +0300 Subject: helix-term: handle scrolling when mouse is enabled (#554) * helix-term: handle scrolling when mouse is enabled Signed-off-by: Dmitry Sharshakov * helix-term: configure scrolling speed Signed-off-by: Dmitry Sharshakov * helix-term: use new config for scrolling Signed-off-by: Dmitry Sharshakov * config: defaults for edtior config Signed-off-by: Dmitry Sharshakov * config: add scroll-lines property Signed-off-by: Dmitry Sharshakov * helix-term: scroll hovered view Signed-off-by: Dmitry Sharshakov * helix-term: support inverted scrolling Signed-off-by: Dmitry Sharshakov * helix-term: remove duplicating code Signed-off-by: Dmitry Sharshakov * helix-term: do not focus view while scrolled Signed-off-by: Dmitry Sharshakov * helix-term: refactor mouse events and scrolling Signed-off-by: Dmitry Sharshakov * simplify Co-authored-by: Blaž Hrastnik --- helix-view/src/editor.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'helix-view') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index e5ba0d51..ec3cedd6 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -21,10 +21,12 @@ use helix_core::Position; use serde::Deserialize; #[derive(Debug, Clone, PartialEq, Deserialize)] -#[serde(rename_all = "kebab-case")] +#[serde(rename_all = "kebab-case", default)] pub struct Config { /// Padding to keep between the edge of the screen and the cursor when scrolling. Defaults to 5. pub scrolloff: usize, + /// Number of lines to scroll at once. Defaults to 3 + pub scroll_lines: isize, /// Mouse support. Defaults to true. pub mouse: bool, } @@ -33,6 +35,7 @@ impl Default for Config { fn default() -> Self { Self { scrolloff: 5, + scroll_lines: 3, mouse: true, } } -- cgit v1.2.3-70-g09d2