open menu in command mode now implemented
This commit is contained in:
@@ -6,27 +6,37 @@ use ratatui::{
|
||||
Frame,
|
||||
};
|
||||
use crate::config::colors::themes::Theme;
|
||||
pub fn render_command_line(
|
||||
f: &mut Frame,
|
||||
area: Rect,
|
||||
input: &str, // This is event_handler.command_input
|
||||
active: bool, // This is event_handler.command_mode
|
||||
theme: &Theme,
|
||||
message: &str, // This is event_handler.command_message
|
||||
// Palette-specific parameters are removed
|
||||
) {
|
||||
// This function now only renders the normal command line.
|
||||
// The find_file_palette_active check in render_ui ensures this is called appropriately.
|
||||
|
||||
pub fn render_command_line(f: &mut Frame, area: Rect, input: &str, active: bool, theme: &Theme, message: &str) {
|
||||
let prompt = if active {
|
||||
":"
|
||||
} else {
|
||||
""
|
||||
};
|
||||
if !active { // If not in normal command mode, render minimally or nothing
|
||||
let paragraph = Paragraph::new("")
|
||||
.block(Block::default().style(Style::default().bg(theme.bg)));
|
||||
f.render_widget(paragraph, area);
|
||||
return;
|
||||
}
|
||||
|
||||
// Combine the prompt, input, and message
|
||||
let display_text = if message.is_empty() {
|
||||
let prompt = ":";
|
||||
let display_text = if message.is_empty() || message == ":" {
|
||||
format!("{}{}", prompt, input)
|
||||
} else {
|
||||
format!("{}{} | {}", prompt, input, message)
|
||||
};
|
||||
|
||||
let style = if active {
|
||||
Style::default().fg(theme.accent)
|
||||
} else {
|
||||
Style::default().fg(theme.fg)
|
||||
if input.is_empty() { // If command was just executed, input is cleared, show message
|
||||
message.to_string()
|
||||
} else { // Show input and message
|
||||
format!("{}{} | {}", prompt, input, message)
|
||||
}
|
||||
};
|
||||
|
||||
let style = Style::default().fg(theme.accent); // Style for active command line
|
||||
let paragraph = Paragraph::new(display_text)
|
||||
.block(Block::default().style(Style::default().bg(theme.bg)))
|
||||
.style(style);
|
||||
|
||||
Reference in New Issue
Block a user