diff options
author | Akshay <[email protected]> | 2021-02-21 04:42:10 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-02-21 04:42:10 +0000 |
commit | 879b115d651b26d3935f5c95d06f426019dedcd3 (patch) | |
tree | bc013d60a48d4603ec496de26494e8ba5b3a86a4 | |
parent | 77368eed146ec8278609e04e395c7ef04c386313 (diff) |
remove all instances of view_month_offsetcursor
-rw-r--r-- | flake.nix | 10 | ||||
-rw-r--r-- | src/app/impl_self.rs | 1 | ||||
-rw-r--r-- | src/app/impl_view.rs | 5 | ||||
-rw-r--r-- | src/app/mod.rs | 1 | ||||
-rw-r--r-- | src/theme.rs | 2 | ||||
-rw-r--r-- | src/utils.rs | 4 | ||||
-rw-r--r-- | src/views.rs | 1 |
7 files changed, 15 insertions, 9 deletions
@@ -19,6 +19,11 @@ | |||
19 | channel = "nightly"; | 19 | channel = "nightly"; |
20 | sha256 = "LbKHsCOFXWpg/SEyACfzZuWjKbkXdH6EJKOPSGoO01E="; # set zeros after modifying channel or date | 20 | sha256 = "LbKHsCOFXWpg/SEyACfzZuWjKbkXdH6EJKOPSGoO01E="; # set zeros after modifying channel or date |
21 | }).rust; | 21 | }).rust; |
22 | rust-src = (mozilla.rustChannelOf { | ||
23 | date = "2020-12-23"; | ||
24 | channel = "nightly"; | ||
25 | sha256 = "LbKHsCOFXWpg/SEyACfzZuWjKbkXdH6EJKOPSGoO01E="; # set zeros after modifying channel or date | ||
26 | }).rust-src; | ||
22 | 27 | ||
23 | naersk-lib = naersk.lib."${system}".override { | 28 | naersk-lib = naersk.lib."${system}".override { |
24 | cargo = rust; | 29 | cargo = rust; |
@@ -37,10 +42,15 @@ | |||
37 | devShell = pkgs.mkShell { | 42 | devShell = pkgs.mkShell { |
38 | nativeBuildInputs = [ | 43 | nativeBuildInputs = [ |
39 | rust | 44 | rust |
45 | rust-src | ||
46 | pkgs.rust-analyzer | ||
40 | pkgs.cargo | 47 | pkgs.cargo |
41 | pkgs.openssl | 48 | pkgs.openssl |
42 | pkgs.ncurses | 49 | pkgs.ncurses |
43 | ]; | 50 | ]; |
51 | shellHook = '' | ||
52 | export RUST_SRC_PATH="${rust-src}/lib/rustlib/src/rust/library" | ||
53 | ''; | ||
44 | }; | 54 | }; |
45 | }); | 55 | }); |
46 | } | 56 | } |
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 | } |
diff --git a/src/theme.rs b/src/theme.rs index 7ae9efc..879584c 100644 --- a/src/theme.rs +++ b/src/theme.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use cursive::theme::Color::{self, *}; | 1 | use cursive::theme::Color::{self, *}; |
2 | use cursive::theme::PaletteColor::*; | 2 | use cursive::theme::PaletteColor::*; |
3 | use cursive::theme::{BorderStyle, ColorStyle, Palette, Style, Theme}; | 3 | use cursive::theme::{BorderStyle, Palette, Theme}; |
4 | 4 | ||
5 | pub fn pallete_gen() -> Palette { | 5 | pub fn pallete_gen() -> Palette { |
6 | let mut p = Palette::default(); | 6 | let mut p = Palette::default(); |
diff --git a/src/utils.rs b/src/utils.rs index 2453aa6..f5a25c8 100644 --- a/src/utils.rs +++ b/src/utils.rs | |||
@@ -102,12 +102,12 @@ pub fn load_configuration_file() -> AppConfig { | |||
102 | if let Ok(ref mut f) = File::open(&cf) { | 102 | if let Ok(ref mut f) = File::open(&cf) { |
103 | let mut j = String::new(); | 103 | let mut j = String::new(); |
104 | f.read_to_string(&mut j); | 104 | f.read_to_string(&mut j); |
105 | return toml::from_str(&j).unwrap(); | 105 | return toml::from_str(&j).unwrap_or_else(|e| panic!("Invalid config file: `{}`", e)); |
106 | } else { | 106 | } else { |
107 | if let Ok(dc) = toml::to_string(&AppConfig::default()) { | 107 | if let Ok(dc) = toml::to_string(&AppConfig::default()) { |
108 | match OpenOptions::new().create(true).write(true).open(&cf) { | 108 | match OpenOptions::new().create(true).write(true).open(&cf) { |
109 | Ok(ref mut file) => file.write(dc.as_bytes()).unwrap(), | 109 | Ok(ref mut file) => file.write(dc.as_bytes()).unwrap(), |
110 | Err(_) => 0, | 110 | Err(_) => panic!("Unable to write config file to disk!"), |
111 | }; | 111 | }; |
112 | } | 112 | } |
113 | return Default::default(); | 113 | return Default::default(); |
diff --git a/src/views.rs b/src/views.rs index f02eb83..b90ce2b 100644 --- a/src/views.rs +++ b/src/views.rs | |||
@@ -41,7 +41,6 @@ where | |||
41 | let month = now.month(); | 41 | let month = now.month(); |
42 | 42 | ||
43 | let goal_reached_style = Style::from(CONFIGURATION.reached_color()); | 43 | let goal_reached_style = Style::from(CONFIGURATION.reached_color()); |
44 | let todo_style = Style::from(CONFIGURATION.todo_color()); | ||
45 | let future_style = Style::from(CONFIGURATION.inactive_color()); | 44 | let future_style = Style::from(CONFIGURATION.inactive_color()); |
46 | 45 | ||
47 | let strikethrough = Style::from(Effect::Strikethrough); | 46 | let strikethrough = Style::from(Effect::Strikethrough); |