diff options
author | Nathan Vegdahl | 2021-07-02 02:37:28 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-07-02 02:37:28 +0000 |
commit | 2224a1527ec9592f16131b0aa3923fc3d37592e7 (patch) | |
tree | 2a08b053cb32cef9dc1db5895778d419ebaebb5b /helix-term/src/ui/prompt.rs | |
parent | e725957704274b1ec814a34ddf6f75faf35358e7 (diff) | |
parent | 9f62ad0715240156b512dfc7c584d2d0df05a664 (diff) |
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
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( |