better vim like cursor
This commit is contained in:
@@ -157,12 +157,13 @@ impl EventHandler {
|
|||||||
}
|
}
|
||||||
"move_right" => {
|
"move_right" => {
|
||||||
let current_input = form_state.get_current_input();
|
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;
|
form_state.current_cursor_pos += 1;
|
||||||
}
|
}
|
||||||
self.ideal_cursor_column = form_state.current_cursor_pos;
|
self.ideal_cursor_column = form_state.current_cursor_pos;
|
||||||
return Ok((false, "".to_string()));
|
return Ok((false, "".to_string()));
|
||||||
}
|
},
|
||||||
"move_up" => {
|
"move_up" => {
|
||||||
if form_state.current_field == 0 {
|
if form_state.current_field == 0 {
|
||||||
// Wrap to the last field when at the top
|
// Wrap to the last field when at the top
|
||||||
|
|||||||
Reference in New Issue
Block a user