down and up now added to work in the original form
This commit is contained in:
@@ -47,6 +47,24 @@ impl ReadOnlyHandler for FormState {
|
||||
Ok("New entry mode".into())
|
||||
}
|
||||
},
|
||||
"move_down" => {
|
||||
self.current_field = (self.current_field + 1) % self.fields.len();
|
||||
let current_input = self.get_current_input();
|
||||
let max_pos = current_input.len().saturating_sub(1);
|
||||
self.current_cursor_pos = self.current_cursor_pos.min(max_pos);
|
||||
Ok("".into())
|
||||
},
|
||||
"move_up" => {
|
||||
if self.current_field == 0 {
|
||||
self.current_field = self.fields.len() - 1;
|
||||
} else {
|
||||
self.current_field = self.current_field.saturating_sub(1);
|
||||
}
|
||||
let current_input = self.get_current_input();
|
||||
let max_pos = current_input.len().saturating_sub(1);
|
||||
self.current_cursor_pos = self.current_cursor_pos.min(max_pos);
|
||||
Ok("".into())
|
||||
},
|
||||
_ => Ok(format!("Unknown action: {}", action))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user