text area on focus is now big
This commit is contained in:
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -415,6 +415,7 @@ dependencies = [
|
|||||||
"tonic",
|
"tonic",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
|
"tui-textarea",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"unicode-width 0.2.0",
|
"unicode-width 0.2.0",
|
||||||
]
|
]
|
||||||
@@ -3606,6 +3607,17 @@ version = "0.2.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a"
|
checksum = "e78122066b0cb818b8afd08f7ed22f7fdbc3e90815035726f0840d0d26c0747a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tui-textarea"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0a5318dd619ed73c52a9417ad19046724effc1287fb75cdcc4eca1d6ac1acbae"
|
||||||
|
dependencies = [
|
||||||
|
"crossterm 0.28.1",
|
||||||
|
"ratatui",
|
||||||
|
"unicode-width 0.2.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typed-arena"
|
name = "typed-arena"
|
||||||
version = "2.0.2"
|
version = "2.0.2"
|
||||||
|
|||||||
@@ -22,5 +22,6 @@ toml = "0.8.20"
|
|||||||
tonic = "0.13.0"
|
tonic = "0.13.0"
|
||||||
tracing = "0.1.41"
|
tracing = "0.1.41"
|
||||||
tracing-subscriber = "0.3.19"
|
tracing-subscriber = "0.3.19"
|
||||||
|
tui-textarea = "0.7.0"
|
||||||
unicode-segmentation = "1.12.0"
|
unicode-segmentation = "1.12.0"
|
||||||
unicode-width = "0.2.0"
|
unicode-width = "0.2.0"
|
||||||
|
|||||||
@@ -33,7 +33,32 @@ pub fn render_add_logic(
|
|||||||
let inner_area = main_block.inner(area);
|
let inner_area = main_block.inner(area);
|
||||||
f.render_widget(main_block, area);
|
f.render_widget(main_block, area);
|
||||||
|
|
||||||
// Calculate areas dynamically like add_table
|
// --- Fullscreen Script Content Check ---
|
||||||
|
if add_logic_state.current_focus == AddLogicFocus::InputScriptContent {
|
||||||
|
let script_block_border_style = Style::default().fg(theme.highlight); // Always highlighted
|
||||||
|
|
||||||
|
let script_block = Block::default()
|
||||||
|
.title(Span::styled(
|
||||||
|
" Steel Script Content (Fullscreen) ",
|
||||||
|
theme.fg,
|
||||||
|
)) // Indicate fullscreen
|
||||||
|
.title_alignment(Alignment::Center)
|
||||||
|
.borders(Borders::ALL)
|
||||||
|
.border_type(BorderType::Rounded)
|
||||||
|
.border_style(script_block_border_style);
|
||||||
|
|
||||||
|
let script_text =
|
||||||
|
Text::from(add_logic_state.script_content_input.as_str());
|
||||||
|
let script_paragraph = Paragraph::new(script_text)
|
||||||
|
.block(script_block)
|
||||||
|
.scroll(add_logic_state.script_content_scroll)
|
||||||
|
.style(Style::default().fg(theme.fg));
|
||||||
|
f.render_widget(script_paragraph, inner_area); // Use inner_area for fullscreen
|
||||||
|
return; // IMPORTANT: Stop rendering here for fullscreen mode
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Normal Layout ---
|
||||||
|
// Calculate areas dynamically
|
||||||
let main_chunks = Layout::default()
|
let main_chunks = Layout::default()
|
||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
.constraints([
|
.constraints([
|
||||||
@@ -49,15 +74,17 @@ pub fn render_add_logic(
|
|||||||
let script_content_area = main_chunks[2];
|
let script_content_area = main_chunks[2];
|
||||||
let buttons_area = main_chunks[3];
|
let buttons_area = main_chunks[3];
|
||||||
|
|
||||||
// Top Info Rendering (like add_table)
|
// Top Info Rendering
|
||||||
let profile_text = Paragraph::new(vec![
|
let profile_text = Paragraph::new(vec![
|
||||||
Line::from(Span::styled(
|
Line::from(Span::styled(
|
||||||
format!("Profile: {}", add_logic_state.profile_name),
|
format!("Profile: {}", add_logic_state.profile_name),
|
||||||
theme.fg,
|
theme.fg,
|
||||||
)),
|
)),
|
||||||
Line::from(Span::styled(
|
Line::from(Span::styled(
|
||||||
format!("Table: {}",
|
format!(
|
||||||
add_logic_state.selected_table_id
|
"Table: {}",
|
||||||
|
add_logic_state
|
||||||
|
.selected_table_id
|
||||||
.map(|id| format!("ID {}", id))
|
.map(|id| format!("ID {}", id))
|
||||||
.unwrap_or_else(|| "Global".to_string())
|
.unwrap_or_else(|| "Global".to_string())
|
||||||
),
|
),
|
||||||
@@ -71,7 +98,7 @@ pub fn render_add_logic(
|
|||||||
);
|
);
|
||||||
f.render_widget(profile_text, top_info_area);
|
f.render_widget(profile_text, top_info_area);
|
||||||
|
|
||||||
// Canvas rendering for input fields (like add_table)
|
// Canvas rendering for input fields
|
||||||
let focus_on_canvas_inputs = matches!(
|
let focus_on_canvas_inputs = matches!(
|
||||||
add_logic_state.current_focus,
|
add_logic_state.current_focus,
|
||||||
AddLogicFocus::InputLogicName
|
AddLogicFocus::InputLogicName
|
||||||
@@ -91,8 +118,9 @@ pub fn render_add_logic(
|
|||||||
highlight_state,
|
highlight_state,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Script Content Area
|
// Script Content Area (Normal Mode)
|
||||||
let script_block_border_style = if add_logic_state.current_focus == AddLogicFocus::InputScriptContent {
|
let script_block_border_style =
|
||||||
|
if add_logic_state.current_focus == AddLogicFocus::InputScriptContent {
|
||||||
Style::default().fg(theme.highlight)
|
Style::default().fg(theme.highlight)
|
||||||
} else {
|
} else {
|
||||||
Style::default().fg(theme.secondary)
|
Style::default().fg(theme.secondary)
|
||||||
@@ -104,14 +132,15 @@ pub fn render_add_logic(
|
|||||||
.border_type(BorderType::Rounded)
|
.border_type(BorderType::Rounded)
|
||||||
.border_style(script_block_border_style);
|
.border_style(script_block_border_style);
|
||||||
|
|
||||||
let script_text = Text::from(add_logic_state.script_content_input.as_str());
|
let script_text =
|
||||||
|
Text::from(add_logic_state.script_content_input.as_str());
|
||||||
let script_paragraph = Paragraph::new(script_text)
|
let script_paragraph = Paragraph::new(script_text)
|
||||||
.block(script_block)
|
.block(script_block)
|
||||||
.scroll(add_logic_state.script_content_scroll)
|
.scroll(add_logic_state.script_content_scroll)
|
||||||
.style(Style::default().fg(theme.fg));
|
.style(Style::default().fg(theme.fg));
|
||||||
f.render_widget(script_paragraph, script_content_area);
|
f.render_widget(script_paragraph, script_content_area);
|
||||||
|
|
||||||
// Button Style Helpers (same as add_table)
|
// Button Style Helpers
|
||||||
let get_button_style = |button_focus: AddLogicFocus, current_focus| {
|
let get_button_style = |button_focus: AddLogicFocus, current_focus| {
|
||||||
let is_focused = current_focus == button_focus;
|
let is_focused = current_focus == button_focus;
|
||||||
let base_style = Style::default().fg(if is_focused {
|
let base_style = Style::default().fg(if is_focused {
|
||||||
@@ -134,7 +163,7 @@ pub fn render_add_logic(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Bottom Buttons (same style as add_table)
|
// Bottom Buttons
|
||||||
let button_chunks = Layout::default()
|
let button_chunks = Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.constraints([
|
.constraints([
|
||||||
@@ -177,7 +206,7 @@ pub fn render_add_logic(
|
|||||||
);
|
);
|
||||||
f.render_widget(cancel_button, button_chunks[1]);
|
f.render_widget(cancel_button, button_chunks[1]);
|
||||||
|
|
||||||
// Dialog rendering (same as add_table)
|
// Dialog rendering
|
||||||
if app_state.ui.dialog.dialog_show {
|
if app_state.ui.dialog.dialog_show {
|
||||||
dialog::render_dialog(
|
dialog::render_dialog(
|
||||||
f,
|
f,
|
||||||
@@ -191,4 +220,3 @@ pub fn render_add_logic(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user