Add vertical scroll to Notes field in EditTask popup
- Added notes_scroll to App and AppView - Up/Down in Notes field scrolls (Tab cycles fields instead) - Reset scroll on opening EditTask popup - Notes Paragraph uses .scroll((notes_scroll, 0))
This commit is contained in:
+21
-4
@@ -37,6 +37,7 @@ pub struct App {
|
||||
pub should_quit: bool,
|
||||
pub task_list_scroll: u16,
|
||||
pub detail_scroll: u16,
|
||||
pub notes_scroll: u16,
|
||||
pub db: Arc<Db>,
|
||||
#[allow(dead_code)]
|
||||
pub api_client: Arc<ApiClient>,
|
||||
@@ -104,6 +105,7 @@ impl App {
|
||||
should_quit: false,
|
||||
task_list_scroll: 0,
|
||||
detail_scroll: 0,
|
||||
notes_scroll: 0,
|
||||
db,
|
||||
api_client,
|
||||
needs_auth: !has_token,
|
||||
@@ -347,6 +349,7 @@ impl App {
|
||||
self.popup_secondary.clear();
|
||||
self.popup_secondary_cursor = 0;
|
||||
self.edit_field = 0;
|
||||
self.notes_scroll = 0;
|
||||
self.show_popup = Some(Popup::EditTask { field: 0 });
|
||||
}
|
||||
}
|
||||
@@ -365,6 +368,7 @@ impl App {
|
||||
self.popup_secondary = task.notes.clone().unwrap_or_default();
|
||||
self.popup_secondary_cursor = self.popup_secondary.len();
|
||||
self.edit_field = 0;
|
||||
self.notes_scroll = 0;
|
||||
self.show_popup = Some(Popup::EditTask { field: 0 });
|
||||
}
|
||||
}
|
||||
@@ -500,15 +504,28 @@ impl App {
|
||||
self.editing_task_id = None;
|
||||
self.show_popup = None;
|
||||
}
|
||||
KeyCode::Tab | KeyCode::Down => {
|
||||
KeyCode::Tab => {
|
||||
let new_field = (field + 1) % 5;
|
||||
self.edit_field = new_field;
|
||||
self.show_popup = Some(Popup::EditTask { field: new_field });
|
||||
}
|
||||
KeyCode::Down => {
|
||||
if *field == 1 {
|
||||
self.notes_scroll = self.notes_scroll.saturating_add(1);
|
||||
} else {
|
||||
let new_field = (field + 1) % 5;
|
||||
self.edit_field = new_field;
|
||||
self.show_popup = Some(Popup::EditTask { field: new_field });
|
||||
}
|
||||
}
|
||||
KeyCode::Up => {
|
||||
let new_field = (field + 4) % 5;
|
||||
self.edit_field = new_field;
|
||||
self.show_popup = Some(Popup::EditTask { field: new_field });
|
||||
if *field == 1 {
|
||||
self.notes_scroll = self.notes_scroll.saturating_sub(1);
|
||||
} else {
|
||||
let new_field = (field + 4) % 5;
|
||||
self.edit_field = new_field;
|
||||
self.show_popup = Some(Popup::EditTask { field: new_field });
|
||||
}
|
||||
}
|
||||
KeyCode::Enter => {
|
||||
let title = self.popup_input.trim().to_string();
|
||||
|
||||
Reference in New Issue
Block a user