diff options
Diffstat (limited to 'src/habit/count.rs')
-rw-r--r-- | src/habit/count.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/habit/count.rs b/src/habit/count.rs index d351758..b14354c 100644 --- a/src/habit/count.rs +++ b/src/habit/count.rs | |||
@@ -1,8 +1,10 @@ | |||
1 | use std::collections::HashMap; | 1 | use std::collections::HashMap; |
2 | 2 | ||
3 | use chrono::NaiveDate; | 3 | use chrono::NaiveDate; |
4 | use cursive::direction::Absolute; | ||
4 | use serde::{Deserialize, Serialize}; | 5 | use serde::{Deserialize, Serialize}; |
5 | 6 | ||
7 | use crate::app::Cursor; | ||
6 | use crate::habit::prelude::default_auto; | 8 | use crate::habit::prelude::default_auto; |
7 | use crate::habit::traits::Habit; | 9 | use crate::habit::traits::Habit; |
8 | use crate::habit::{TrackEvent, ViewMode}; | 10 | use crate::habit::{TrackEvent, ViewMode}; |
@@ -20,6 +22,9 @@ pub struct Count { | |||
20 | view_month_offset: u32, | 22 | view_month_offset: u32, |
21 | 23 | ||
22 | #[serde(skip)] | 24 | #[serde(skip)] |
25 | cursor: Cursor, | ||
26 | |||
27 | #[serde(skip)] | ||
23 | view_mode: ViewMode, | 28 | view_mode: ViewMode, |
24 | } | 29 | } |
25 | 30 | ||
@@ -31,6 +36,7 @@ impl Count { | |||
31 | goal, | 36 | goal, |
32 | auto, | 37 | auto, |
33 | view_month_offset: 0, | 38 | view_month_offset: 0, |
39 | cursor: Cursor::new(), | ||
34 | view_mode: ViewMode::Day, | 40 | view_mode: ViewMode::Day, |
35 | }; | 41 | }; |
36 | } | 42 | } |
@@ -101,6 +107,12 @@ impl Habit for Count { | |||
101 | fn view_month_offset(&self) -> u32 { | 107 | fn view_month_offset(&self) -> u32 { |
102 | self.view_month_offset | 108 | self.view_month_offset |
103 | } | 109 | } |
110 | fn move_cursor(&mut self, d: Absolute) { | ||
111 | self.cursor.do_move(d); | ||
112 | } | ||
113 | fn cursor(&self) -> Cursor { | ||
114 | self.cursor | ||
115 | } | ||
104 | fn set_view_mode(&mut self, mode: ViewMode) { | 116 | fn set_view_mode(&mut self, mode: ViewMode) { |
105 | self.view_mode = mode; | 117 | self.view_mode = mode; |
106 | } | 118 | } |