only to the top and to the bottom in the canvas, cant jump around anymore

This commit is contained in:
filipriec
2025-04-06 23:16:15 +02:00
parent 5879b40e8c
commit 803c748738
4 changed files with 8 additions and 24 deletions

View File

@@ -173,11 +173,7 @@ pub async fn execute_edit_action<S: CanvasState>(
let num_fields = state.fields().len();
if num_fields > 0 {
let current_field = state.current_field();
let new_field = if current_field == 0 {
num_fields - 1
} else {
current_field - 1
};
let new_field = current_field.saturating_sub(1);
state.set_current_field(new_field);
let current_input = state.get_current_input();
let max_pos = current_input.len();
@@ -191,7 +187,7 @@ pub async fn execute_edit_action<S: CanvasState>(
"move_down" => {
let num_fields = state.fields().len();
if num_fields > 0 {
let new_field = (state.current_field() + 1) % num_fields;
let new_field = (state.current_field() + 1).min(num_fields - 1);
state.set_current_field(new_field);
let current_input = state.get_current_input();
let max_pos = current_input.len();