From ee9be05579d87ca99f153d20995af3273385b564 Mon Sep 17 00:00:00 2001 From: nc Date: Wed, 5 Aug 2020 22:08:51 -0400 Subject: Override Ctrl-C by disabling callback in Cursive Thanks to @gyscos for the explanation in #22! Also removed extraneous code that's no longer needed. --- src/app/impl_self.rs | 1 - src/app/impl_view.rs | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/app') diff --git a/src/app/impl_self.rs b/src/app/impl_self.rs index 325c53f..c2a24cf 100644 --- a/src/app/impl_self.rs +++ b/src/app/impl_self.rs @@ -24,7 +24,6 @@ impl App { let (tx, rx) = channel(); let mut watcher = watcher(tx, Duration::from_secs(1)).unwrap(); watcher.watch(utils::auto_habit_file(), RecursiveMode::Recursive); - return App { habits: vec![], focus: 0, diff --git a/src/app/impl_view.rs b/src/app/impl_view.rs index b735003..1261208 100644 --- a/src/app/impl_view.rs +++ b/src/app/impl_view.rs @@ -85,6 +85,7 @@ impl View for App { if self.habits.is_empty() { return EventResult::Ignored; } + let m = self.message.clone(); match e { Event::Key(Key::Right) | Event::Key(Key::Tab) | Event::Char('l') => { self.set_focus(Absolute::Right); @@ -166,7 +167,7 @@ impl View for App { return EventResult::Consumed(None); } Event::CtrlChar('c') => { - self.message.write().unwrap().set_message("Use the :q command to quit"); + m.write().unwrap().set_message("Use the :q command to quit"); return EventResult::Consumed(None); } -- cgit v1.2.3