diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/views.rs | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/views.rs b/src/views.rs index 81eaf6c..64c85ce 100644 --- a/src/views.rs +++ b/src/views.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use cursive::direction::Direction; | 1 | use cursive::direction::Direction; |
2 | use cursive::event::{Event, EventResult, Key}; | 2 | use cursive::event::{Event, EventResult, Key}; |
3 | use cursive::theme::Style; | 3 | use cursive::theme::{Effect, Style}; |
4 | use cursive::view::View; | 4 | use cursive::view::View; |
5 | use cursive::{Printer, Vec2}; | 5 | use cursive::{Printer, Vec2}; |
6 | 6 | ||
@@ -39,24 +39,26 @@ where | |||
39 | let todo_style = Style::from(CONFIGURATION.todo_color); | 39 | let todo_style = Style::from(CONFIGURATION.todo_color); |
40 | let future_style = Style::from(CONFIGURATION.future_color); | 40 | let future_style = Style::from(CONFIGURATION.future_color); |
41 | 41 | ||
42 | let goal_reached_today = self.reached_goal(Local::now().naive_utc().date()); | 42 | let done_today_style = Style::from(Effect::Strikethrough); |
43 | if goal_reached_today { | 43 | |
44 | printer.with_style(goal_reached_style, |p| p.print((0, 0), "[x]")); | 44 | let goal_status = |
45 | } else { | 45 | self.view_month_offset() == 0 && self.reached_goal(Local::now().naive_utc().date()); |
46 | printer.with_style(todo_style, |p| p.print((0, 0), "[ ]")); | ||
47 | } | ||
48 | 46 | ||
49 | printer.with_style( | 47 | printer.with_style( |
50 | if !printer.focused { | 48 | Style::merge(&[ |
51 | future_style | 49 | if goal_status { |
52 | } else { | 50 | done_today_style |
53 | Style::none() | 51 | } else { |
54 | }, | 52 | Style::none() |
53 | }, | ||
54 | if !printer.focused { | ||
55 | future_style | ||
56 | } else { | ||
57 | Style::none() | ||
58 | }, | ||
59 | ]), | ||
55 | |p| { | 60 | |p| { |
56 | p.print( | 61 | p.print((0, 0), &format!(" {} ", self.name())); |
57 | (4, 0), | ||
58 | &format!("{:width$}", self.name(), width = CONFIGURATION.view_width), | ||
59 | ) | ||
60 | }, | 62 | }, |
61 | ); | 63 | ); |
62 | 64 | ||