diff options
author | nc <[email protected]> | 2020-07-20 23:30:32 +0100 |
---|---|---|
committer | nc <[email protected]> | 2020-07-20 23:30:32 +0100 |
commit | 66b2f0793f236dccd3269ae1c3cbfe2293f7fb3d (patch) | |
tree | 0e1a2604d9d395bda8d8eaae12353014b6adc836 /src/app/impl_view.rs | |
parent | 2a3be003015bac9c6a13549029b9fb4595e88384 (diff) |
Add RwLock around messages. Catch SIGINT and print that :q is the way to quit.
Note that this doesn't actually capture Ctrl-C. I'm not sure how it works
but termion somehow swollows Ctrl-C so and circumvents the signal handler...
Diffstat (limited to 'src/app/impl_view.rs')
-rw-r--r-- | src/app/impl_view.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/app/impl_view.rs b/src/app/impl_view.rs index 892b00c..acc387e 100644 --- a/src/app/impl_view.rs +++ b/src/app/impl_view.rs | |||
@@ -39,8 +39,8 @@ impl View for App { | |||
39 | printer.print(offset, &status.1); // right status | 39 | printer.print(offset, &status.1); // right status |
40 | 40 | ||
41 | offset = offset.map_x(|_| 0).map_y(|_| self.max_size().y - 1); | 41 | offset = offset.map_x(|_| 0).map_y(|_| self.max_size().y - 1); |
42 | printer.with_style(Color::from(self.message.kind()), |p| { | 42 | printer.with_style(Color::from(self.message.read().unwrap().kind()), |p| { |
43 | p.print(offset, self.message.contents()) | 43 | p.print(offset, self.message.read().unwrap().contents()) |
44 | }); | 44 | }); |
45 | } | 45 | } |
46 | 46 | ||
@@ -161,8 +161,8 @@ impl View for App { | |||
161 | return EventResult::Consumed(None); | 161 | return EventResult::Consumed(None); |
162 | } | 162 | } |
163 | Event::CtrlChar('l') => { | 163 | Event::CtrlChar('l') => { |
164 | self.message.clear(); | 164 | self.message.write().unwrap().clear(); |
165 | self.message.set_kind(MessageKind::Info); | 165 | self.message.write().unwrap().set_kind(MessageKind::Info); |
166 | return EventResult::Consumed(None); | 166 | return EventResult::Consumed(None); |
167 | } | 167 | } |
168 | 168 | ||