aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.rs13
-rw-r--r--src/command.rs2
2 files changed, 10 insertions, 5 deletions
diff --git a/src/app.rs b/src/app.rs
index 7495dd8..44de5bb 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -192,6 +192,12 @@ impl App {
192 } 192 }
193 Command::MonthNext => self.sift_forward(), 193 Command::MonthNext => self.sift_forward(),
194 Command::MonthPrev => self.sift_backward(), 194 Command::MonthPrev => self.sift_backward(),
195
196 // we can get away with calling an event here,
197 // saves us some writing
198 Command::Quit => {
199 self.on_event(Event::Char('q'));
200 }
195 _ => { 201 _ => {
196 eprintln!("UNKNOWN COMMAND!"); 202 eprintln!("UNKNOWN COMMAND!");
197 } 203 }
@@ -284,7 +290,7 @@ impl View for App {
284 return EventResult::Consumed(None); 290 return EventResult::Consumed(None);
285 } 291 }
286 Event::Char('q') => { 292 Event::Char('q') => {
287 // self.save_state(); 293 self.save_state();
288 return EventResult::with_cb(|s| s.quit()); 294 return EventResult::with_cb(|s| s.quit());
289 } 295 }
290 296
@@ -304,10 +310,7 @@ impl View for App {
304 * s down to the focused Habit We sift back to today 310 * s down to the focused Habit We sift back to today
305 * before performing any action, "refocusing" the cursor 311 * before performing any action, "refocusing" the cursor
306 * */ 312 * */
307 _ => { 313 _ => self.habits[self.focus].on_event(e),
308 self.set_view_month_offset(0);
309 self.habits[self.focus].on_event(e)
310 }
311 } 314 }
312 } 315 }
313} 316}
diff --git a/src/command.rs b/src/command.rs
index f94eab8..d25608f 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -21,6 +21,7 @@ pub enum Command {
21 MonthPrev, 21 MonthPrev,
22 MonthNext, 22 MonthNext,
23 Delete(String), 23 Delete(String),
24 Quit,
24 Blank, 25 Blank,
25} 26}
26 27
@@ -53,6 +54,7 @@ impl Command {
53 } 54 }
54 "mprev" | "month-prev" => return Command::MonthPrev, 55 "mprev" | "month-prev" => return Command::MonthPrev,
55 "mnext" | "month-next" => return Command::MonthNext, 56 "mnext" | "month-next" => return Command::MonthNext,
57 "q" | "quit" => return Command::Quit,
56 _ => return Command::Blank, 58 _ => return Command::Blank,
57 } 59 }
58 } 60 }