diff options
author | Akshay <[email protected]> | 2021-02-21 05:13:32 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-02-21 05:13:32 +0000 |
commit | 38d9dfee224ebcd088c0ebecd9e1243994eea409 (patch) | |
tree | 1215766f07b1c2eaf68f20aba284e710eb9a24a3 /src/habit/mod.rs | |
parent | ad5bf181a176e64c9f70a292cad870e6e8110f09 (diff) | |
parent | 53f7a679a0cf7a510de13d67cf370988f71c0d08 (diff) |
Merge branch 'cursor' into master
Diffstat (limited to 'src/habit/mod.rs')
-rw-r--r-- | src/habit/mod.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/habit/mod.rs b/src/habit/mod.rs index 75e734a..d51abe5 100644 --- a/src/habit/mod.rs +++ b/src/habit/mod.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | use std::default::Default; | ||
2 | |||
1 | mod traits; | 3 | mod traits; |
2 | pub use traits::{Habit, HabitWrapper}; | 4 | pub use traits::{Habit, HabitWrapper}; |
3 | 5 | ||
@@ -9,3 +11,28 @@ pub use bit::Bit; | |||
9 | 11 | ||
10 | mod prelude; | 12 | mod prelude; |
11 | pub use prelude::{TrackEvent, ViewMode}; | 13 | pub use prelude::{TrackEvent, ViewMode}; |
14 | |||
15 | use crate::app::Cursor; | ||
16 | |||
17 | use cursive::direction::Absolute; | ||
18 | |||
19 | #[derive(Debug, Default)] | ||
20 | pub struct InnerData { | ||
21 | pub cursor: Cursor, | ||
22 | pub view_mode: ViewMode, | ||
23 | } | ||
24 | |||
25 | impl InnerData { | ||
26 | pub fn move_cursor(&mut self, d: Absolute) { | ||
27 | self.cursor.small_seek(d); | ||
28 | } | ||
29 | pub fn cursor(&self) -> Cursor { | ||
30 | self.cursor | ||
31 | } | ||
32 | pub fn set_view_mode(&mut self, mode: ViewMode) { | ||
33 | self.view_mode = mode; | ||
34 | } | ||
35 | pub fn view_mode(&self) -> ViewMode { | ||
36 | self.view_mode | ||
37 | } | ||
38 | } | ||