exit in the general mode is on esc and select is not escaping in the add_table anymore

This commit is contained in:
filipriec
2025-04-18 10:37:52 +02:00
parent f50fe788cb
commit 6bfef1c7a0
3 changed files with 81 additions and 20 deletions

View File

@@ -37,6 +37,30 @@ pub fn handle_add_table_navigation(
);
match action.as_deref() {
// --- Handle Exiting Table Scroll Mode ---
Some("exit_table_scroll") => {
match current_focus {
AddTableFocus::InsideColumnsTable => {
new_focus = AddTableFocus::ColumnsTable;
*command_message = "Exited Columns Table".to_string();
}
AddTableFocus::InsideIndexesTable => {
new_focus = AddTableFocus::IndexesTable;
*command_message = "Exited Indexes Table".to_string();
}
AddTableFocus::InsideLinksTable => {
new_focus = AddTableFocus::LinksTable;
*command_message = "Exited Links Table".to_string();
}
_ => {
// Action triggered but not applicable in this focus state
handled = false;
}
}
// If handled (i.e., focus changed), handled remains true.
// If not handled, handled becomes false.
}
// --- Vertical Navigation (Up/Down) ---
Some("move_up") => {
match current_focus {
@@ -184,12 +208,20 @@ pub fn handle_add_table_navigation(
*command_message = "Entered Links Table (Scroll with Up/Down, Select to toggle/exit)".to_string();
}
AddTableFocus::InsideColumnsTable => {
new_focus = AddTableFocus::ColumnsTable; // Exit back to block focus
*command_message = "Exited Columns Table".to_string();
// Select does nothing here anymore, only Esc exits.
if let Some(index) = add_table_state.column_table_state.selected() {
*command_message = format!("Selected column index {} (Press Esc to exit scroll mode)", index);
} else {
*command_message = "No column selected (Press Esc to exit scroll mode)".to_string();
}
}
AddTableFocus::InsideIndexesTable => {
new_focus = AddTableFocus::IndexesTable; // Exit back to block focus
*command_message = "Exited Indexes Table".to_string();
// Select does nothing here anymore, only Esc exits.
if let Some(index) = add_table_state.index_table_state.selected() {
*command_message = format!("Selected index index {} (Press Esc to exit scroll mode)", index);
} else {
*command_message = "No index selected (Press Esc to exit scroll mode)".to_string();
}
}
AddTableFocus::InsideLinksTable => {
// Toggle selection when pressing select *inside* the links table