aboutsummaryrefslogtreecommitdiff
path: root/src/app/impl_self.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/impl_self.rs')
-rw-r--r--src/app/impl_self.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/app/impl_self.rs b/src/app/impl_self.rs
index fad965a..b53cdcf 100644
--- a/src/app/impl_self.rs
+++ b/src/app/impl_self.rs
@@ -11,9 +11,10 @@ use cursive::direction::Absolute;
11use cursive::Vec2; 11use cursive::Vec2;
12use notify::{watcher, RecursiveMode, Watcher}; 12use notify::{watcher, RecursiveMode, Watcher};
13 13
14use crate::CONFIGURATION;
14use crate::command::{Command, CommandLineError, GoalKind}; 15use crate::command::{Command, CommandLineError, GoalKind};
15use crate::habit::{Bit, Count, Float, HabitWrapper, TrackEvent, ViewMode}; 16use crate::habit::{Bit, Count, Float, HabitWrapper, TrackEvent, ViewMode};
16use crate::utils::{self, GRID_WIDTH, VIEW_HEIGHT, VIEW_WIDTH}; 17use crate::utils::{self, VIEW_HEIGHT, VIEW_WIDTH};
17 18
18use crate::app::{App, Cursor, Message, MessageKind, StatusLine}; 19use crate::app::{App, Cursor, Message, MessageKind, StatusLine};
19 20
@@ -105,15 +106,15 @@ impl App {
105 } 106 }
106 } 107 }
107 Absolute::Down => { 108 Absolute::Down => {
108 if self.focus + GRID_WIDTH < self.habits.len() - 1 { 109 if self.focus + CONFIGURATION.grid_size() < self.habits.len() - 1 {
109 self.focus += GRID_WIDTH; 110 self.focus += CONFIGURATION.grid_size();
110 } else { 111 } else {
111 self.focus = self.habits.len() - 1; 112 self.focus = self.habits.len() - 1;
112 } 113 }
113 } 114 }
114 Absolute::Up => { 115 Absolute::Up => {
115 if self.focus as isize - GRID_WIDTH as isize >= 0 { 116 if self.focus as isize - CONFIGURATION.grid_size() as isize >= 0 {
116 self.focus -= GRID_WIDTH; 117 self.focus -= CONFIGURATION.grid_size();
117 } else { 118 } else {
118 self.focus = 0; 119 self.focus = 0;
119 } 120 }
@@ -152,10 +153,10 @@ impl App {
152 } 153 }
153 154
154 pub fn max_size(&self) -> Vec2 { 155 pub fn max_size(&self) -> Vec2 {
155 let width = GRID_WIDTH * VIEW_WIDTH; 156 let width = CONFIGURATION.grid_size() * VIEW_WIDTH;
156 let height = { 157 let height = {
157 if !self.habits.is_empty() { 158 if !self.habits.is_empty() {
158 (VIEW_HEIGHT as f64 * (self.habits.len() as f64 / GRID_WIDTH as f64).ceil()) 159 (VIEW_HEIGHT as f64 * (self.habits.len() as f64 / CONFIGURATION.grid_size() as f64).ceil())
159 as usize 160 as usize
160 } else { 161 } else {
161 0 162 0