diff options
author | Jan Hrastnik | 2020-10-13 16:57:55 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-10-16 03:01:21 +0000 |
commit | 7d58378374388c031ad09ceb2e27d4a0792d636e (patch) | |
tree | 087f82de0253f16458db12b4f608a8ed5d5435b9 /helix-term/src | |
parent | ed03ec92a825b8e42005f2f8506b0f3db4923fa5 (diff) |
added move left&right, delete char
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/editor.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs index 22ede486..78456654 100644 --- a/helix-term/src/editor.rs +++ b/helix-term/src/editor.rs @@ -237,7 +237,7 @@ impl Editor { Mode::Insert => "INS", Mode::Normal => "NOR", Mode::Goto => "GOTO", - Mode::Prompt => "PRO", // prompt? + Mode::Command => "COM", // command? }; // statusline self.surface.set_style( @@ -249,14 +249,17 @@ impl Editor { } pub fn render_prompt(&mut self, text_color: Style) { + // TODO: maybe name this render_commandline use tui::backend::Backend; let view = self.view.as_ref().unwrap(); // render buffer text let buffer_string; - if view.state.mode == Mode::Prompt { + if view.state.mode == Mode::Command { buffer_string = &self.prompt.buffer; self.surface - .set_string(1, self.size.1 - 1, buffer_string, text_color); + .set_string(1, self.size.1 - 1, String::from(":"), text_color); + self.surface + .set_string(2, self.size.1 - 1, buffer_string, text_color); } else { buffer_string = &String::from(""); } @@ -277,8 +280,8 @@ impl Editor { Mode::Insert => write!(stdout, "\x1B[6 q"), mode => write!(stdout, "\x1B[2 q"), }; - if view.state.mode() == Mode::Prompt { - pos = Position::new(self.size.0 as usize, 1 + self.prompt.buffer.len()); + if view.state.mode() == Mode::Command { + pos = Position::new(self.size.0 as usize, 2 + self.prompt.cursor_loc); } else { if let Some(path) = view.state.path() { self.surface @@ -346,8 +349,8 @@ impl Editor { } view.ensure_cursor_in_view(); } - Mode::Prompt => { - self.prompt.handle_keyevent(event, view); + Mode::Command => { + self.prompt.handle_input(event, view); } mode => { if let Some(command) = keymap[&mode].get(&keys) { |