deletion of the selected works
This commit is contained in:
@@ -7,6 +7,7 @@ use crate::state::{
|
||||
use crossterm::event::{KeyEvent};
|
||||
use ratatui::widgets::TableState;
|
||||
use crate::tui::functions::common::add_table::handle_add_column_action;
|
||||
use crate::tui::functions::common::add_table::handle_delete_selected_columns;
|
||||
|
||||
/// Handles navigation events specifically for the Add Table view.
|
||||
/// Returns true if the event was handled, false otherwise.
|
||||
@@ -199,12 +200,19 @@ pub fn handle_add_table_navigation(
|
||||
*command_message = "Entered Links Table (Scroll with Up/Down, Select to toggle/exit)".to_string();
|
||||
}
|
||||
AddTableFocus::InsideColumnsTable => {
|
||||
// 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();
|
||||
}
|
||||
// Toggle selection when pressing select *inside* the columns table
|
||||
if let Some(index) = add_table_state.column_table_state.selected() {
|
||||
if let Some(col) = add_table_state.columns.get_mut(index) {
|
||||
col.selected = !col.selected;
|
||||
add_table_state.has_unsaved_changes = true;
|
||||
*command_message = format!(
|
||||
"Toggled selection for column: {} to {}",
|
||||
col.name, col.selected
|
||||
);
|
||||
}
|
||||
} else {
|
||||
*command_message = "No column highlighted to toggle selection".to_string();
|
||||
}
|
||||
}
|
||||
AddTableFocus::InsideIndexesTable => {
|
||||
// Select does nothing here anymore, only Esc exits.
|
||||
@@ -247,8 +255,7 @@ pub fn handle_add_table_navigation(
|
||||
// TODO: Implement logic
|
||||
}
|
||||
AddTableFocus::DeleteSelectedButton => {
|
||||
*command_message = "Action: Delete selected".to_string();
|
||||
// TODO: Implement logic
|
||||
handle_delete_selected_columns(add_table_state, command_message);
|
||||
}
|
||||
AddTableFocus::CancelButton => {
|
||||
*command_message = "Action: Cancel Add Table".to_string();
|
||||
|
||||
Reference in New Issue
Block a user