diff options
Diffstat (limited to 'helix-term/src/ui/prompt.rs')
-rw-r--r-- | helix-term/src/ui/prompt.rs | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 6bb1b006..a4cb26f7 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -5,13 +5,11 @@ use std::{borrow::Cow, ops::RangeFrom}; use tui::buffer::Buffer as Surface; use helix_core::{ - unicode::segmentation::{GraphemeCursor, GraphemeIncomplete}, - unicode::width::UnicodeWidthStr, - Position, + unicode::segmentation::GraphemeCursor, unicode::width::UnicodeWidthStr, Position, }; use helix_view::{ - graphics::{Color, CursorKind, Margin, Modifier, Rect, Style}, - Editor, Theme, + graphics::{CursorKind, Margin, Rect}, + Editor, }; pub type Completion = (RangeFrom<usize>, Cow<'static, str>); @@ -399,6 +397,22 @@ impl Component for Prompt { return close_fn; } KeyEvent { + code: KeyCode::Left, + modifiers: KeyModifiers::ALT, + } + | KeyEvent { + code: KeyCode::Char('b'), + modifiers: KeyModifiers::ALT, + } => self.move_cursor(Movement::BackwardWord(1)), + KeyEvent { + code: KeyCode::Right, + modifiers: KeyModifiers::ALT, + } + | KeyEvent { + code: KeyCode::Char('f'), + modifiers: KeyModifiers::ALT, + } => self.move_cursor(Movement::ForwardWord(1)), + KeyEvent { code: KeyCode::Char('f'), modifiers: KeyModifiers::CONTROL, } @@ -431,22 +445,6 @@ impl Component for Prompt { modifiers: KeyModifiers::CONTROL, } => self.move_start(), KeyEvent { - code: KeyCode::Left, - modifiers: KeyModifiers::ALT, - } - | KeyEvent { - code: KeyCode::Char('b'), - modifiers: KeyModifiers::ALT, - } => self.move_cursor(Movement::BackwardWord(1)), - KeyEvent { - code: KeyCode::Right, - modifiers: KeyModifiers::ALT, - } - | KeyEvent { - code: KeyCode::Char('f'), - modifiers: KeyModifiers::ALT, - } => self.move_cursor(Movement::ForwardWord(1)), - KeyEvent { code: KeyCode::Char('w'), modifiers: KeyModifiers::CONTROL, } => self.delete_word_backwards(), @@ -494,7 +492,7 @@ impl Component for Prompt { self.render_prompt(area, surface, cx) } - fn cursor(&self, area: Rect, editor: &Editor) -> (Option<Position>, CursorKind) { + fn cursor(&self, area: Rect, _editor: &Editor) -> (Option<Position>, CursorKind) { let line = area.height as usize - 1; ( Some(Position::new( |