diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-04-04 11:16:54 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-04-04 11:16:54 +0200 |
commit | d54479c3e09fa8aaeb5838ee00ed407ce7a65d44 (patch) | |
tree | 5f1b90de77f2f2f870566a911643e601ac20f48e /src | |
parent | 40dc45e7bd8fbf631c981b45df739f23713f29c7 (diff) |
Let ctrl-U do the expected thing
Diffstat (limited to 'src')
-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 => { |