diff --git a/src/core/ev_handler.rs b/src/core/ev_handler.rs index 0c7e335..223d722 100644 --- a/src/core/ev_handler.rs +++ b/src/core/ev_handler.rs @@ -44,6 +44,7 @@ pub fn handle_event( display::draw_for_change(out, p, &mut um)?; p.upper_mark = um; } + Command::UserInput(InputEvent::UpdateLeftMark(lm)) => p.left_mark = lm, Command::UserInput(InputEvent::RestorePrompt) => { // Set the message to None and new messages to false as all messages have been shown p.message = None; diff --git a/src/input/mod.rs b/src/input/mod.rs index 76b489f..91e1878 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -106,6 +106,8 @@ pub enum InputEvent { UpdateUpperMark(usize), /// `Ctrl+L`, inverts the line number display. Contains the new value. UpdateLineNumber(LineNumbers), + /// `Right`, `Left`, `h` or `l` was pressed + UpdateLeftMark(usize), /// A number key has been pressed. This inner value is stored as a `char`. /// The input loop will append this number to its `count` string variable Number(char), @@ -440,6 +442,7 @@ impl InputClassifier for DefaultInputClassifier { modifiers: KeyModifiers::CONTROL, .. }) => Some(InputEvent::UpdateLineNumber(!ps.line_numbers)), + // Quit. Event::Key(KeyEvent { code: KeyCode::Char('q'), @@ -451,6 +454,26 @@ impl InputClassifier for DefaultInputClassifier { modifiers: KeyModifiers::CONTROL, .. }) => Some(InputEvent::Exit), + + // Horizontal scrolling + Event::Key(KeyEvent { + code: KeyCode::Char('h'), + modifiers: KeyModifiers::NONE, + }) + | Event::Key(KeyEvent { + code: KeyCode::Left, + modifiers: KeyModifiers::NONE, + }) => Some(InputEvent::UpdateLeftMark(ps.left_mark.saturating_sub(1))), + Event::Key(KeyEvent { + code: KeyCode::Char('l'), + modifiers: KeyModifiers::NONE, + }) + | Event::Key(KeyEvent { + code: KeyCode::Right, + modifiers: KeyModifiers::NONE, + }) => Some(InputEvent::UpdateLeftMark(ps.left_mark.saturating_add(1))), + + // Search #[cfg(feature = "search")] Event::Key(KeyEvent { code: KeyCode::Char('/'),