aboutsummaryrefslogtreecommitdiff
path: root/src/habit/mod.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-02-21 05:13:32 +0000
committerAkshay <[email protected]>2021-02-21 05:13:32 +0000
commit38d9dfee224ebcd088c0ebecd9e1243994eea409 (patch)
tree1215766f07b1c2eaf68f20aba284e710eb9a24a3 /src/habit/mod.rs
parentad5bf181a176e64c9f70a292cad870e6e8110f09 (diff)
parent53f7a679a0cf7a510de13d67cf370988f71c0d08 (diff)
Merge branch 'cursor' into master
Diffstat (limited to 'src/habit/mod.rs')
-rw-r--r--src/habit/mod.rs27
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 @@
1use std::default::Default;
2
1mod traits; 3mod traits;
2pub use traits::{Habit, HabitWrapper}; 4pub use traits::{Habit, HabitWrapper};
3 5
@@ -9,3 +11,28 @@ pub use bit::Bit;
9 11
10mod prelude; 12mod prelude;
11pub use prelude::{TrackEvent, ViewMode}; 13pub use prelude::{TrackEvent, ViewMode};
14
15use crate::app::Cursor;
16
17use cursive::direction::Absolute;
18
19#[derive(Debug, Default)]
20pub struct InnerData {
21 pub cursor: Cursor,
22 pub view_mode: ViewMode,
23}
24
25impl 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}