move to top and bottom, needs redesign of config

This commit is contained in:
filipriec
2025-02-25 22:04:07 +01:00
parent 8a23af7f3f
commit 08bbd9bd29
2 changed files with 26 additions and 0 deletions

View File

@@ -20,6 +20,8 @@ move_word_prev = ["b"] # Move to beginning of previous word
move_word_end_prev = ["ge"] # Move to end of previous word
move_line_start = ["0"] # Move to beginning of line
move_line_end = ["$"] # Move to end of line
move_first_line = ["t"] # Move to first line of form
move_last_line = ["G"] # Move to last line of form
[colors]
theme = "dark"

View File

@@ -273,6 +273,30 @@ impl EventHandler {
}
return Ok((false, "".to_string()));
}
"move_first_line" => {
// Jump to first field
form_state.current_field = 0;
let current_input = form_state.get_current_input();
let max_cursor_pos = if !self.is_edit_mode && !current_input.is_empty() {
current_input.len() - 1
} else {
current_input.len()
};
form_state.current_cursor_pos = self.ideal_cursor_column.min(max_cursor_pos);
return Ok((false, "".to_string()));
}
"move_last_line" => {
// Jump to last field
form_state.current_field = form_state.fields.len() - 1;
let current_input = form_state.get_current_input();
let max_cursor_pos = if !self.is_edit_mode && !current_input.is_empty() {
current_input.len() - 1
} else {
current_input.len()
};
form_state.current_cursor_pos = self.ideal_cursor_column.min(max_cursor_pos);
return Ok((false, "".to_string()));
}
_ => {}
}
}