diff options
Diffstat (limited to 'src/app/impl_view.rs')
-rw-r--r-- | src/app/impl_view.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/app/impl_view.rs b/src/app/impl_view.rs index 904403b..0a6bce6 100644 --- a/src/app/impl_view.rs +++ b/src/app/impl_view.rs | |||
@@ -5,11 +5,12 @@ use std::path::PathBuf; | |||
5 | 5 | ||
6 | use cursive::direction::{Absolute, Direction}; | 6 | use cursive::direction::{Absolute, Direction}; |
7 | use cursive::event::{Event, EventResult, Key}; | 7 | use cursive::event::{Event, EventResult, Key}; |
8 | use cursive::theme::{Color, Style}; | ||
8 | use cursive::view::View; | 9 | use cursive::view::View; |
9 | use cursive::{Printer, Vec2}; | 10 | use cursive::{Printer, Vec2}; |
10 | use notify::DebouncedEvent; | 11 | use notify::DebouncedEvent; |
11 | 12 | ||
12 | use crate::app::App; | 13 | use crate::app::{App, MessageKind}; |
13 | use crate::habit::{HabitWrapper, ViewMode}; | 14 | use crate::habit::{HabitWrapper, ViewMode}; |
14 | use crate::utils; | 15 | use crate::utils; |
15 | use crate::CONFIGURATION; | 16 | use crate::CONFIGURATION; |
@@ -36,6 +37,11 @@ impl View for App { | |||
36 | let full = self.max_size().x; | 37 | let full = self.max_size().x; |
37 | offset = offset.map_x(|_| full - status.1.len()); | 38 | offset = offset.map_x(|_| full - status.1.len()); |
38 | printer.print(offset, &status.1); // right status | 39 | printer.print(offset, &status.1); // right status |
40 | |||
41 | offset = offset.map_x(|_| 0).map_y(|_| self.max_size().y - 1); | ||
42 | printer.with_style(Color::from(self.message.kind()), |p| { | ||
43 | p.print(offset, self.message.contents()) | ||
44 | }); | ||
39 | } | 45 | } |
40 | 46 | ||
41 | fn required_size(&mut self, _: Vec2) -> Vec2 { | 47 | fn required_size(&mut self, _: Vec2) -> Vec2 { |
@@ -158,6 +164,11 @@ impl View for App { | |||
158 | self.set_view_month_offset(0); | 164 | self.set_view_month_offset(0); |
159 | return EventResult::Consumed(None); | 165 | return EventResult::Consumed(None); |
160 | } | 166 | } |
167 | Event::CtrlChar('l') => { | ||
168 | self.message.clear(); | ||
169 | self.message.set_kind(MessageKind::Info); | ||
170 | return EventResult::Consumed(None); | ||
171 | } | ||
161 | 172 | ||
162 | /* Every keybind that is not caught by App trickles | 173 | /* Every keybind that is not caught by App trickles |
163 | * down to the focused habit. We sift back to today | 174 | * down to the focused habit. We sift back to today |