diff --git a/client/src/ui/handlers/event.rs b/client/src/ui/handlers/event.rs index c9ae880..1734bc4 100644 --- a/client/src/ui/handlers/event.rs +++ b/client/src/ui/handlers/event.rs @@ -157,12 +157,13 @@ impl EventHandler { } "move_right" => { let current_input = form_state.get_current_input(); - if form_state.current_cursor_pos < current_input.len() { + // Change this line to prevent moving past the last character + if !current_input.is_empty() && form_state.current_cursor_pos < current_input.len() - 1 { form_state.current_cursor_pos += 1; } self.ideal_cursor_column = form_state.current_cursor_pos; return Ok((false, "".to_string())); - } + }, "move_up" => { if form_state.current_field == 0 { // Wrap to the last field when at the top