This commit is contained in:
filipriec
2025-03-24 11:17:59 +01:00
parent 1eb2edc1df
commit ec5802b3a2
2 changed files with 33 additions and 1 deletions

View File

@@ -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"]

View File

@@ -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))),
}
}