more fixes
This commit is contained in:
@@ -86,7 +86,6 @@ impl EventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle command mode with highest priority
|
||||
if self.command_mode {
|
||||
let (should_exit, message, exit_command_mode) = command_mode::handle_command_event(
|
||||
key,
|
||||
@@ -104,19 +103,10 @@ impl EventHandler {
|
||||
self.command_mode = false;
|
||||
}
|
||||
|
||||
if !message.is_empty() || should_exit {
|
||||
return Ok((should_exit, message));
|
||||
}
|
||||
|
||||
return Ok((false, String::new()));
|
||||
return Ok((should_exit, message));
|
||||
}
|
||||
|
||||
// Mode transitions and mode-specific handling
|
||||
if self.is_edit_mode {
|
||||
// When in EDIT mode, we DON'T want to check for entering command mode
|
||||
// as ':' should just be a normal character input
|
||||
|
||||
// Check for exiting edit mode
|
||||
if config.is_exit_edit_mode(key.code, key.modifiers) {
|
||||
if form_state.has_unsaved_changes {
|
||||
self.command_message = "Unsaved changes! Use :w to save or :q! to discard".to_string();
|
||||
@@ -135,7 +125,6 @@ impl EventHandler {
|
||||
return Ok((false, self.command_message.clone()));
|
||||
}
|
||||
|
||||
// Handle edit mode events
|
||||
let result = edit::handle_edit_event_internal(
|
||||
key,
|
||||
config,
|
||||
@@ -143,17 +132,15 @@ impl EventHandler {
|
||||
&mut self.ideal_cursor_column,
|
||||
&mut self.command_message,
|
||||
terminal,
|
||||
grpc_client,
|
||||
is_saved,
|
||||
current_position,
|
||||
total_count,
|
||||
grpc_client, // Moved to end to match parameter order
|
||||
).await?;
|
||||
|
||||
self.key_sequence_tracker.reset();
|
||||
return Ok((false, result));
|
||||
} else {
|
||||
// In READ-ONLY mode, we DO want to check for entering command mode
|
||||
// Check for entering command mode (only in read-only mode)
|
||||
if let Some(action) = config.get_read_only_action_for_key(key.code, key.modifiers) {
|
||||
if action == "enter_command_mode" {
|
||||
self.command_mode = true;
|
||||
@@ -163,7 +150,6 @@ impl EventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for entering edit mode from read-only mode
|
||||
if config.is_enter_edit_mode_before(key.code, key.modifiers) {
|
||||
self.is_edit_mode = true;
|
||||
self.edit_mode_cooldown = true;
|
||||
@@ -185,7 +171,6 @@ impl EventHandler {
|
||||
return Ok((false, self.command_message.clone()));
|
||||
}
|
||||
|
||||
// Handle read-only mode events
|
||||
return read_only::handle_read_only_event(
|
||||
key,
|
||||
config,
|
||||
@@ -194,10 +179,10 @@ impl EventHandler {
|
||||
current_position,
|
||||
total_count,
|
||||
terminal,
|
||||
grpc_client,
|
||||
&mut self.command_message,
|
||||
&mut self.edit_mode_cooldown,
|
||||
&mut self.ideal_cursor_column,
|
||||
grpc_client, // Moved to end
|
||||
).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user