From ec5802b3a270d6e770a46cce5385c1a7bfc0d22a Mon Sep 17 00:00:00 2001 From: filipriec Date: Mon, 24 Mar 2025 11:17:59 +0100 Subject: [PATCH] works --- client/config.toml | 2 +- client/src/modes/handlers/event.rs | 32 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/client/config.toml b/client/config.toml index 5850bcc..292734a 100644 --- a/client/config.toml +++ b/client/config.toml @@ -35,7 +35,7 @@ next_entry = ["right","1"] move_left = ["h"] move_right = ["l"] -move_up = ["k"] +move_up = ["k", "Up"] move_down = ["j"] move_word_next = ["w"] move_word_end = ["e"] diff --git a/client/src/modes/handlers/event.rs b/client/src/modes/handlers/event.rs index 7dfa5a3..c200b72 100644 --- a/client/src/modes/handlers/event.rs +++ b/client/src/modes/handlers/event.rs @@ -327,6 +327,38 @@ impl EventHandler { ).await?; Ok((false, message)) }, + "move_up" => { + if form_state.current_field == 0 { + form_state.current_field = form_state.fields.len() - 1; + } else { + form_state.current_field = form_state.current_field.saturating_sub(1); + } + let current_input = form_state.get_current_input(); + let max_cursor_pos = if !current_input.is_empty() { + current_input.len() - 1 + } else { + 0 + }; + form_state.current_cursor_pos = self.ideal_cursor_column.min(max_cursor_pos); + Ok((false, String::new())) + }, + "move_down" => { + form_state.current_field = (form_state.current_field + 1) % form_state.fields.len(); + let current_input = form_state.get_current_input(); + let max_cursor_pos = if !current_input.is_empty() { + current_input.len() - 1 + } else { + 0 + }; + form_state.current_cursor_pos = self.ideal_cursor_column.min(max_cursor_pos); + Ok((false, String::new())) + }, + "toggle_sidebar" => { + navigation::toggle_sidebar(app_state); + Ok((false, format!("Sidebar {}", + if app_state.ui.show_sidebar { "shown" } else { "hidden" } + ))) + }, _ => Ok((false, format!("Unknown common action: {}", action))), } }