aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/impl_self.rs1
-rw-r--r--src/app/impl_view.rs5
-rw-r--r--src/app/mod.rs1
3 files changed, 2 insertions, 5 deletions
diff --git a/src/app/impl_self.rs b/src/app/impl_self.rs
index fec7219..d5f93ff 100644
--- a/src/app/impl_self.rs
+++ b/src/app/impl_self.rs
@@ -27,7 +27,6 @@ impl App {
27 focus: 0, 27 focus: 0,
28 _file_watcher: watcher, 28 _file_watcher: watcher,
29 file_event_recv: rx, 29 file_event_recv: rx,
30 view_month_offset: 0,
31 cursor: Cursor::new(), 30 cursor: Cursor::new(),
32 message: Message::startup(), 31 message: Message::startup(),
33 }; 32 };
diff --git a/src/app/impl_view.rs b/src/app/impl_view.rs
index db05432..98f540c 100644
--- a/src/app/impl_view.rs
+++ b/src/app/impl_view.rs
@@ -134,6 +134,7 @@ impl View for App {
134 for habit in self.habits.iter_mut() { 134 for habit in self.habits.iter_mut() {
135 habit.inner_data_mut_ref().set_view_mode(ViewMode::Day); 135 habit.inner_data_mut_ref().set_view_mode(ViewMode::Day);
136 } 136 }
137 self.reset_cursor();
137 return EventResult::Consumed(None); 138 return EventResult::Consumed(None);
138 } 139 }
139 140
@@ -159,14 +160,12 @@ impl View for App {
159 } 160 }
160 161
161 /* Every keybind that is not caught by App trickles 162 /* Every keybind that is not caught by App trickles
162 * down to the focused habit. We sift back to today 163 * down to the focused habit.
163 * before performing any action, "refocusing" the cursor
164 * */ 164 * */
165 _ => { 165 _ => {
166 if self.habits.is_empty() { 166 if self.habits.is_empty() {
167 return EventResult::Ignored; 167 return EventResult::Ignored;
168 } 168 }
169 self.reset_cursor();
170 self.habits[self.focus].on_event(e) 169 self.habits[self.focus].on_event(e)
171 } 170 }
172 } 171 }
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 9432f0d..726a656 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -21,7 +21,6 @@ pub struct App {
21 _file_watcher: RecommendedWatcher, 21 _file_watcher: RecommendedWatcher,
22 file_event_recv: Receiver<DebouncedEvent>, 22 file_event_recv: Receiver<DebouncedEvent>,
23 focus: usize, 23 focus: usize,
24 view_month_offset: u32,
25 cursor: Cursor, 24 cursor: Cursor,
26 message: Message, 25 message: Message,
27} 26}