aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-12 22:06:23 -0800
committerAndy Wortman <ixineeringeverywhere@gmail.com>2017-11-12 22:46:42 -0800
commit2a5ef2c5301663759c5f70835b4183e73c7261d3 (patch)
tree2a174457f2f85697615491423f2a08de24f52ea6
parent2d6deb832245c6400c51ee228817549e7b9364b5 (diff)
support ctrl+u similarly to readline
-rw-r--r--src/main.rs12
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)) => {