fixing warnings
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// src/modes/handlers/event.rs
|
||||
|
||||
use crossterm::event::{Event, KeyCode, KeyEvent};
|
||||
use crossterm::event::{Event, KeyEvent};
|
||||
use crossterm::cursor::SetCursorStyle;
|
||||
use crate::tui::terminal::AppTerminal;
|
||||
use crate::config::config::Config;
|
||||
@@ -97,10 +97,16 @@ impl EventHandler {
|
||||
}
|
||||
|
||||
// Handle edit mode events
|
||||
return self.handle_edit_mode_internal(
|
||||
key, config, app_terminal, form_state,
|
||||
is_saved, current_position, total_count
|
||||
).await;
|
||||
let result = edit::handle_edit_event_internal(
|
||||
key,
|
||||
config,
|
||||
form_state,
|
||||
&mut self.ideal_cursor_column,
|
||||
&mut self.command_message,
|
||||
).await?;
|
||||
|
||||
self.key_sequence_tracker.reset();
|
||||
return Ok((false, result));
|
||||
} else {
|
||||
// Check for entering edit mode from read-only mode
|
||||
if config.is_enter_edit_mode(key.code, key.modifiers) {
|
||||
@@ -119,9 +125,17 @@ impl EventHandler {
|
||||
}
|
||||
|
||||
// Handle read-only mode events
|
||||
return self.handle_read_only_mode_internal(
|
||||
key, config, app_terminal, form_state,
|
||||
current_position, total_count
|
||||
return read_only::handle_read_only_event(
|
||||
key,
|
||||
config,
|
||||
form_state,
|
||||
&mut self.key_sequence_tracker,
|
||||
current_position,
|
||||
total_count,
|
||||
app_terminal,
|
||||
&mut self.command_message,
|
||||
&mut self.edit_mode_cooldown,
|
||||
&mut self.ideal_cursor_column,
|
||||
).await;
|
||||
}
|
||||
}
|
||||
@@ -129,51 +143,4 @@ impl EventHandler {
|
||||
self.edit_mode_cooldown = false;
|
||||
Ok((false, self.command_message.clone()))
|
||||
}
|
||||
|
||||
async fn handle_edit_mode_internal(
|
||||
&mut self,
|
||||
key: KeyEvent,
|
||||
config: &Config,
|
||||
app_terminal: &mut AppTerminal,
|
||||
form_state: &mut FormState,
|
||||
is_saved: &mut bool,
|
||||
current_position: &mut u64,
|
||||
total_count: u64,
|
||||
) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
||||
// We're calling the edit handler, but we know we're not in command mode
|
||||
// and we've already handled exit_edit_mode transition above
|
||||
let result = edit::handle_edit_event_internal(
|
||||
key,
|
||||
config,
|
||||
form_state,
|
||||
&mut self.ideal_cursor_column,
|
||||
&mut self.command_message,
|
||||
).await?;
|
||||
|
||||
self.key_sequence_tracker.reset();
|
||||
Ok((false, result))
|
||||
}
|
||||
|
||||
async fn handle_read_only_mode_internal(
|
||||
&mut self,
|
||||
key: KeyEvent,
|
||||
config: &Config,
|
||||
app_terminal: &mut AppTerminal,
|
||||
form_state: &mut FormState,
|
||||
current_position: &mut u64,
|
||||
total_count: u64,
|
||||
) -> Result<(bool, String), Box<dyn std::error::Error>> {
|
||||
read_only::handle_read_only_event(
|
||||
key,
|
||||
config,
|
||||
form_state,
|
||||
&mut self.key_sequence_tracker,
|
||||
current_position,
|
||||
total_count,
|
||||
app_terminal,
|
||||
&mut self.command_message,
|
||||
&mut self.edit_mode_cooldown,
|
||||
&mut self.ideal_cursor_column,
|
||||
).await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user