diff options
-rw-r--r-- | Cargo.lock | 1 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/app/impl_self.rs | 1 | ||||
-rw-r--r-- | src/app/impl_view.rs | 3 | ||||
-rw-r--r-- | src/main.rs | 9 |
5 files changed, 5 insertions, 10 deletions
@@ -271,7 +271,6 @@ dependencies = [ | |||
271 | "notify", | 271 | "notify", |
272 | "serde", | 272 | "serde", |
273 | "serde_json", | 273 | "serde_json", |
274 | "signal-hook", | ||
275 | "typetag", | 274 | "typetag", |
276 | ] | 275 | ] |
277 | 276 | ||
@@ -19,7 +19,6 @@ typetag = "0.1.4" | |||
19 | directories = "3.0.1" | 19 | directories = "3.0.1" |
20 | clap = "2.33" | 20 | clap = "2.33" |
21 | notify = "4.0" | 21 | notify = "4.0" |
22 | signal-hook = "0.1.16" | ||
23 | 22 | ||
24 | [dependencies.cursive] | 23 | [dependencies.cursive] |
25 | version = "0.15" | 24 | version = "0.15" |
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 { | |||
24 | let (tx, rx) = channel(); | 24 | let (tx, rx) = channel(); |
25 | let mut watcher = watcher(tx, Duration::from_secs(1)).unwrap(); | 25 | let mut watcher = watcher(tx, Duration::from_secs(1)).unwrap(); |
26 | watcher.watch(utils::auto_habit_file(), RecursiveMode::Recursive); | 26 | watcher.watch(utils::auto_habit_file(), RecursiveMode::Recursive); |
27 | |||
28 | return App { | 27 | return App { |
29 | habits: vec![], | 28 | habits: vec![], |
30 | focus: 0, | 29 | 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 { | |||
85 | if self.habits.is_empty() { | 85 | if self.habits.is_empty() { |
86 | return EventResult::Ignored; | 86 | return EventResult::Ignored; |
87 | } | 87 | } |
88 | let m = self.message.clone(); | ||
88 | match e { | 89 | match e { |
89 | Event::Key(Key::Right) | Event::Key(Key::Tab) | Event::Char('l') => { | 90 | Event::Key(Key::Right) | Event::Key(Key::Tab) | Event::Char('l') => { |
90 | self.set_focus(Absolute::Right); | 91 | self.set_focus(Absolute::Right); |
@@ -166,7 +167,7 @@ impl View for App { | |||
166 | return EventResult::Consumed(None); | 167 | return EventResult::Consumed(None); |
167 | } | 168 | } |
168 | Event::CtrlChar('c') => { | 169 | Event::CtrlChar('c') => { |
169 | self.message.write().unwrap().set_message("Use the :q command to quit"); | 170 | m.write().unwrap().set_message("Use the :q command to quit"); |
170 | return EventResult::Consumed(None); | 171 | return EventResult::Consumed(None); |
171 | } | 172 | } |
172 | 173 | ||
diff --git a/src/main.rs b/src/main.rs index d733f97..3ec964a 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -50,13 +50,11 @@ fn main() { | |||
50 | ), | 50 | ), |
51 | } | 51 | } |
52 | } else { | 52 | } else { |
53 | let mut s = termion().unwrap(); | ||
53 | let app = App::load_state(); | 54 | let app = App::load_state(); |
54 | let m = app.message.clone(); | ||
55 | unsafe { signal_hook::register(signal_hook::SIGINT, move || { | ||
56 | m.write().unwrap().set_message("Use the :q command to quit"); | ||
57 | }) }.unwrap(); | ||
58 | 55 | ||
59 | let mut s = termion().unwrap(); | 56 | // prevent Ctrl-C from killing the app and allow the app to override it. |
57 | s.clear_global_callbacks(cursive::event::Event::CtrlChar('c')); | ||
60 | 58 | ||
61 | let layout = NamedView::new( | 59 | let layout = NamedView::new( |
62 | "Frame", | 60 | "Frame", |
@@ -66,7 +64,6 @@ fn main() { | |||
66 | s.add_global_callback(':', |s| open_command_window(s)); | 64 | s.add_global_callback(':', |s| open_command_window(s)); |
67 | 65 | ||
68 | s.set_theme(theme::theme_gen()); | 66 | s.set_theme(theme::theme_gen()); |
69 | |||
70 | s.run(); | 67 | s.run(); |
71 | } | 68 | } |
72 | } | 69 | } |