exit in the general mode is on esc and select is not escaping in the add_table anymore
This commit is contained in:
@@ -271,22 +271,50 @@ pub fn render_add_table(
|
||||
};
|
||||
|
||||
// --- Add Button Rendering ---
|
||||
let add_button = Paragraph::new(" Add ")
|
||||
.style(get_button_style(
|
||||
AddTableFocus::AddColumnButton,
|
||||
add_table_state.current_focus,
|
||||
))
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(get_button_border_style(
|
||||
AddTableFocus::AddColumnButton,
|
||||
add_table_state.current_focus,
|
||||
)),
|
||||
);
|
||||
f.render_widget(add_button, add_button_area);
|
||||
let is_add_button_focused =
|
||||
add_table_state.current_focus == AddTableFocus::AddColumnButton;
|
||||
|
||||
// 1. Define the block with ONLY border styling (no background here)
|
||||
let add_button_block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(if is_add_button_focused {
|
||||
Style::default().fg(theme.highlight) // Highlighted border
|
||||
} else {
|
||||
Style::default().fg(theme.secondary) // Normal border
|
||||
});
|
||||
// DO NOT add .style(Style::default().bg(...)) here
|
||||
|
||||
// 2. Render the border block first
|
||||
// Need to clone the block because inner() consumes it
|
||||
let inner_add_button_area = add_button_block.clone().inner(add_button_area);
|
||||
f.render_widget(add_button_block, add_button_area);
|
||||
|
||||
// 3. If focused, render a background fill widget INSIDE the inner area
|
||||
if is_add_button_focused {
|
||||
let background_fill = Block::default() // Or Paragraph::new("")
|
||||
.style(Style::default().bg(theme.highlight));
|
||||
f.render_widget(background_fill, inner_add_button_area);
|
||||
}
|
||||
|
||||
// 4. Define the paragraph text style (FG color and bold only)
|
||||
let mut add_button_text_style = Style::default().fg(if is_add_button_focused {
|
||||
theme.bg // Reversed text color for contrast on highlight bg
|
||||
} else {
|
||||
theme.secondary // Normal text color
|
||||
});
|
||||
|
||||
if is_add_button_focused {
|
||||
add_button_text_style = add_button_text_style.add_modifier(Modifier::BOLD);
|
||||
}
|
||||
|
||||
let add_button_paragraph = Paragraph::new(" Add ")
|
||||
.style(add_button_text_style) // Style without BG
|
||||
.alignment(Alignment::Center);
|
||||
|
||||
// 5. Render the text paragraph inside the inner area (on top of the background fill)
|
||||
f.render_widget(add_button_paragraph, inner_add_button_area);
|
||||
|
||||
|
||||
// --- Indexes Table Rendering ---
|
||||
let indexes_focused = matches!(add_table_state.current_focus, AddTableFocus::IndexesTable | AddTableFocus::InsideIndexesTable);
|
||||
|
||||
Reference in New Issue
Block a user