letter a to get from read only mode to edit mode implemented and working perfectly well
This commit is contained in:
@@ -4,7 +4,7 @@ save = [":w", "ctrl+s"]
|
|||||||
quit = [":q", "ctrl+q"]
|
quit = [":q", "ctrl+q"]
|
||||||
force_quit = [":q!", "ctrl+shift+q"]
|
force_quit = [":q!", "ctrl+shift+q"]
|
||||||
save_and_quit = [":wq", "ctrl+shift+s"]
|
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"]
|
exit_edit_mode = ["esc", "ctrl+e"]
|
||||||
previous_position = ["Left", "9"]
|
previous_position = ["Left", "9"]
|
||||||
next_position = ["Right", "8"]
|
next_position = ["Right", "8"]
|
||||||
|
|||||||
@@ -47,6 +47,14 @@ impl EventHandler {
|
|||||||
) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
||||||
if let Event::Key(key) = event {
|
if let Event::Key(key) = event {
|
||||||
if !self.is_edit_mode && config.is_enter_edit_mode(key.code, key.modifiers) {
|
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.is_edit_mode = true;
|
||||||
self.edit_mode_cooldown = true;
|
self.edit_mode_cooldown = true;
|
||||||
self.command_message = "Edit mode".to_string();
|
self.command_message = "Edit mode".to_string();
|
||||||
|
|||||||
Reference in New Issue
Block a user