From ed03ec92a825b8e42005f2f8506b0f3db4923fa5 Mon Sep 17 00:00:00 2001 From: Jan Hrastnik Date: Tue, 13 Oct 2020 00:23:48 +0200 Subject: moved prompt command matching to prompt.rs --- helix-view/src/commands.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'helix-view/src/commands.rs') diff --git a/helix-view/src/commands.rs b/helix-view/src/commands.rs index 6efbf98d..888317e7 100644 --- a/helix-view/src/commands.rs +++ b/helix-view/src/commands.rs @@ -307,8 +307,20 @@ pub fn append_mode(view: &mut View, _count: usize) { }) } -pub fn command_mode(view: &mut View, _count: usize) { - view.state.mode = Mode::Command; +pub fn prompt_mode(view: &mut View, _count: usize) { + view.state.mode = Mode::Prompt; +} + +pub fn move_char_left_prompt(prompt: &mut Prompt, _char: char) { + if prompt.cursor_loc > 1 { + prompt.cursor_loc -= 1; + } +} + +pub fn move_char_right_prompt(prompt: &mut Prompt, _char: char) { + if prompt.cursor_loc < prompt.buffer.len() { + prompt.cursor_loc += 1; + } } // TODO: I, A, o and O can share a lot of the primitives. -- cgit v1.2.3-70-g09d2