From 2a5ef2c5301663759c5f70835b4183e73c7261d3 Mon Sep 17 00:00:00 2001 From: Andy Wortman Date: Sun, 12 Nov 2017 22:06:23 -0800 Subject: support ctrl+u similarly to readline --- src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.rs b/src/main.rs index 031ad37..6bed875 100644 --- a/src/main.rs +++ b/src/main.rs @@ -272,6 +272,18 @@ fn handle_input(event: termion::event::Event, tweeter: &mut tw::TwitterCache, qu } // would Shift('\n') but.. that doesn't exist. // would Ctrl('\n') but.. that doesn't work. + Event::Key(Key::Ctrl('u')) => { + match tweeter.display_info.mode.clone() { + None => tweeter.display_info.input_buf = vec![], + Some(display::DisplayMode::Compose(msg)) => { + // TODO: clear only one line? + tweeter.display_info.mode = Some(display::DisplayMode::Compose("".to_owned())); + } + Some(display::DisplayMode::Reply(twid, msg)) => { + tweeter.display_info.mode = Some(display::DisplayMode::Reply(twid, "".to_owned())); + } + } + } Event::Key(Key::Ctrl('n')) => { match tweeter.display_info.mode.clone() { Some(display::DisplayMode::Compose(msg)) => { -- cgit v1.1