letter a to get from read only mode to edit mode implemented and working perfectly well

This commit is contained in:
filipriec
2025-02-25 14:23:50 +01:00
parent 5e11ea2585
commit 71b373d661
2 changed files with 9 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ save = [":w", "ctrl+s"]
quit = [":q", "ctrl+q"]
force_quit = [":q!", "ctrl+shift+q"]
save_and_quit = [":wq", "ctrl+shift+s"]
enter_edit_mode = ["i", "ctrl+e"]
enter_edit_mode = ["i", "ctrl+e", "a"]
exit_edit_mode = ["esc", "ctrl+e"]
previous_position = ["Left", "9"]
next_position = ["Right", "8"]

View File

@@ -47,6 +47,14 @@ impl EventHandler {
) -> Result<(bool, String), Box<dyn std::error::Error>> {
if let Event::Key(key) = event {
if !self.is_edit_mode && config.is_enter_edit_mode(key.code, key.modifiers) {
if key.code == KeyCode::Char('a') {
// Move cursor position one character to the right (after current character)
let current_input = form_state.get_current_input();
if !current_input.is_empty() && form_state.current_cursor_pos < current_input.len() {
form_state.current_cursor_pos += 1;
self.ideal_cursor_column = form_state.current_cursor_pos;
}
}
self.is_edit_mode = true;
self.edit_mode_cooldown = true;
self.command_message = "Edit mode".to_string();