fixing warnings
This commit is contained in:
@@ -16,8 +16,6 @@ pub async fn handle_edit_event_internal(
|
||||
) -> Result<String, Box<dyn std::error::Error>> {
|
||||
// Try to match against configured action mappings first
|
||||
let mut key_sequence_tracker = KeySequenceTracker::new(800);
|
||||
|
||||
// Phase 1: Check for configured key bindings
|
||||
let mut handled_by_config = false;
|
||||
|
||||
if key.modifiers.is_empty() {
|
||||
@@ -26,20 +24,16 @@ pub async fn handle_edit_event_internal(
|
||||
|
||||
// Try to match the current sequence against all bindings
|
||||
if let Some(action) = config.matches_key_sequence_generalized(&sequence) {
|
||||
let result = execute_edit_action(
|
||||
return execute_edit_action(
|
||||
action,
|
||||
form_state,
|
||||
ideal_cursor_column,
|
||||
command_message,
|
||||
).await?;
|
||||
handled_by_config = true;
|
||||
return Ok(result);
|
||||
).await;
|
||||
}
|
||||
|
||||
// Check if this might be a prefix of a longer sequence
|
||||
if config.is_key_sequence_prefix(&sequence) {
|
||||
// If it's a prefix, wait for more keys
|
||||
handled_by_config = true;
|
||||
return Ok(command_message.clone());
|
||||
}
|
||||
|
||||
@@ -47,39 +41,30 @@ pub async fn handle_edit_event_internal(
|
||||
if sequence.len() == 1 && !config.is_key_sequence_prefix(&sequence) {
|
||||
// Try to handle it as a single key
|
||||
if let Some(action) = config.get_action_for_key(key.code, key.modifiers) {
|
||||
let result = execute_edit_action(
|
||||
return execute_edit_action(
|
||||
action,
|
||||
form_state,
|
||||
ideal_cursor_column,
|
||||
command_message,
|
||||
).await?;
|
||||
handled_by_config = true;
|
||||
return Ok(result);
|
||||
).await;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If modifiers are pressed, check for direct key bindings
|
||||
if let Some(action) = config.get_action_for_key(key.code, key.modifiers) {
|
||||
let result = execute_edit_action(
|
||||
return execute_edit_action(
|
||||
action,
|
||||
form_state,
|
||||
ideal_cursor_column,
|
||||
command_message,
|
||||
).await?;
|
||||
handled_by_config = true;
|
||||
return Ok(result);
|
||||
).await;
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 2: Fallback to default hardcoded behavior only if not handled by configuration
|
||||
if !handled_by_config {
|
||||
// This is now explicitly a fallback for when no config match is found
|
||||
handle_edit_specific_input(
|
||||
key,
|
||||
form_state,
|
||||
ideal_cursor_column,
|
||||
);
|
||||
}
|
||||
// If we get here, no key mapping was found, so we handle fallback behavior
|
||||
handle_edit_specific_input(
|
||||
key,
|
||||
form_state,
|
||||
ideal_cursor_column,
|
||||
);
|
||||
|
||||
Ok(command_message.clone())
|
||||
}
|
||||
@@ -90,16 +75,16 @@ pub async fn handle_edit_event(
|
||||
key: KeyEvent,
|
||||
config: &Config,
|
||||
form_state: &mut FormState,
|
||||
is_edit_mode: &mut bool,
|
||||
_is_edit_mode: &mut bool,
|
||||
edit_mode_cooldown: &mut bool,
|
||||
ideal_cursor_column: &mut usize,
|
||||
command_message: &mut String,
|
||||
command_mode: &mut bool,
|
||||
command_input: &mut String,
|
||||
app_terminal: &mut AppTerminal,
|
||||
is_saved: &mut bool,
|
||||
current_position: &mut u64,
|
||||
total_count: u64,
|
||||
_command_mode: &mut bool,
|
||||
_command_input: &mut String,
|
||||
_app_terminal: &mut AppTerminal,
|
||||
_is_saved: &mut bool,
|
||||
_current_position: &mut u64,
|
||||
_total_count: u64,
|
||||
) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
||||
// This function should ideally not be called anymore - everything should go through event.rs
|
||||
// Log a warning that this code path is deprecated
|
||||
@@ -195,7 +180,6 @@ async fn execute_edit_action(
|
||||
action: &str,
|
||||
form_state: &mut FormState,
|
||||
ideal_cursor_column: &mut usize,
|
||||
command_message: &mut String,
|
||||
) -> Result<String, Box<dyn std::error::Error>> {
|
||||
match action {
|
||||
// Navigation actions
|
||||
|
||||
Reference in New Issue
Block a user