move to top and bottom, needs redesign of config
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user