diff options
author | iximeow <me@iximeow.net> | 2017-11-12 22:06:23 -0800 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2017-11-12 22:46:42 -0800 |
commit | 63056a669de831ee7cd42517028657c4a23bf3e7 (patch) | |
tree | 2a174457f2f85697615491423f2a08de24f52ea6 | |
parent | b89e3ca265050eb71d75ccb9a41230b38e4d54c6 (diff) |
support ctrl+u similarly to readline
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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)) => { |