it works amazingly well now, we can select the table name via command line
This commit is contained in:
@@ -35,7 +35,9 @@ use crate::modes::{
|
||||
canvas::{edit, read_only, common_mode},
|
||||
general::{navigation, dialog},
|
||||
};
|
||||
use crate::modes::general::command_navigation::{NavigationState, handle_command_navigation_event};
|
||||
use crate::modes::general::command_navigation::{
|
||||
handle_command_navigation_event, NavigationState, TableDependencyGraph,
|
||||
};
|
||||
use crate::functions::modes::navigation::{admin_nav, add_table_nav};
|
||||
use crate::config::binds::key_sequences::KeySequenceTracker;
|
||||
use tokio::sync::mpsc;
|
||||
@@ -580,30 +582,26 @@ impl EventHandler {
|
||||
}
|
||||
|
||||
if let KeyCode::Char(c) = key_code {
|
||||
if c == 'f' {
|
||||
if c == 'f' { // Assuming 'f' is part of the sequence, e.g. ":f" or " f"
|
||||
self.key_sequence_tracker.add_key(key_code);
|
||||
let sequence = self.key_sequence_tracker.get_sequence();
|
||||
|
||||
if config.matches_key_sequence_generalized(&sequence) == Some("find_file_palette_toggle") {
|
||||
if app_state.ui.show_form || app_state.ui.show_intro {
|
||||
let options = vec![
|
||||
"src/main.rs".to_string(),
|
||||
"src/lib.rs".to_string(),
|
||||
"Cargo.toml".to_string(),
|
||||
"README.md".to_string(),
|
||||
"config.toml".to_string(),
|
||||
"src/ui/handlers/ui.rs".to_string(),
|
||||
"src/modes/handlers/event.rs".to_string(),
|
||||
"another_file.txt".to_string(),
|
||||
"yet_another_one.md".to_string(),
|
||||
];
|
||||
self.activate_find_file(options);
|
||||
self.command_mode = false;
|
||||
// Build table graph from profile data
|
||||
let graph = TableDependencyGraph::from_profile_tree(&app_state.profile_tree);
|
||||
|
||||
// Activate navigation with graph
|
||||
self.navigation_state.activate_table_tree(graph);
|
||||
|
||||
self.command_mode = false; // Exit command mode
|
||||
self.command_input.clear();
|
||||
self.command_message = "Find File:".to_string();
|
||||
// Message is set by render_find_file_palette's prompt_prefix
|
||||
self.command_message.clear(); // Clear old command message
|
||||
self.key_sequence_tracker.reset();
|
||||
app_state.update_mode(AppMode::General);
|
||||
return Ok(EventOutcome::Ok("Find File palette activated".to_string()));
|
||||
// ModeManager will derive AppMode::General due to navigation_state.active
|
||||
// app_state.update_mode(AppMode::General); // This will be handled by ModeManager
|
||||
return Ok(EventOutcome::Ok("Table tree palette activated".to_string()));
|
||||
} else {
|
||||
self.key_sequence_tracker.reset();
|
||||
self.command_input.push('f');
|
||||
|
||||
Reference in New Issue
Block a user