diff options
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 062c080..3527410 100644 --- a/src/main.rs +++ b/src/main.rs @@ -105,8 +105,10 @@ fn handle_key(key: Key, st: &mut State) -> Option<bool> { // Editing Key::Ctrl('u') => { - st.input_buffer.clear(); - print!("\r{}{}", termion::clear::CurrentLine, PROMPT_STR); + st.input_buffer.drain(..st.input_cursor); + print!("\r{}{}{}\r{}", + PROMPT_STR, st.input_buffer, termion::clear::UntilNewline, + termion::cursor::Right(PROMPT_STR.len() as u16)); st.input_cursor = 0; } Key::Backspace => { |