Fix TUI display formatting issues for better terminal compatibility

- Simplified header design from complex Unicode borders to fixed-width lines
- Streamlined status bar from multi-line bordered display to clean single-line format
- Fixed terminal width calculation dependencies that caused layout breaks
- Enhanced status display: "🤖 Model Provider • 💾 Session" format
- Improved features display with color-coded indicators (✓/✗)
- Removed problematic border calculations causing wrapping issues
- All display tests pass, maintains functionality while fixing visual problems

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
leach 2025-08-30 23:55:13 -04:00
parent 11ae676101
commit 1a1df93521
2 changed files with 980 additions and 129 deletions

View File

@ -42,16 +42,19 @@ impl ChatCLI {
pub async fn run(&mut self) -> Result<()> {
self.display.print_header();
self.display
.print_info("Type your message and press Enter. Commands start with '/'.");
self.display.print_info("Type /help for help.");
// Enhanced status bar with comprehensive information
let provider = get_provider_for_model(&self.session.model);
let display_name = get_display_name_for_model(&self.session.model);
self.display
.print_model_info(&display_name, provider.as_str());
self.display.print_session_info(&self.session.name);
let features = vec![
("Web Search", self.session.enable_web_search),
("Reasoning", self.session.enable_reasoning_summary),
("Extended Thinking", self.session.enable_extended_thinking),
];
self.display.print_status_bar(&display_name, provider.as_str(), &self.session.name, &features);
self.display.print_info("Type your message and press Enter. Commands start with '/' (try /help).");
println!();
loop {
@ -68,7 +71,16 @@ impl ChatCLI {
}
} else {
if let Err(e) = self.handle_user_message(line).await {
self.display.print_error(&format!("Error: {}", e));
// Enhanced error display with context and suggestions
let error_msg = format!("Error: {}", e);
let context = Some("This error occurred while processing your message.");
let suggestions = vec![
"Check your API key configuration",
"Verify your internet connection",
"Try switching to a different model with /model",
"Use /help to see available commands"
];
self.display.print_error_with_context(&error_msg, context, &suggestions);
}
println!(); // Add padding before next prompt
}
@ -425,33 +437,18 @@ impl ChatCLI {
async fn tools_manager(&mut self) -> Result<()> {
loop {
// Show current tool status
self.display.print_info("Tool Management:");
let web_status = if self.session.enable_web_search {
"✓ enabled"
} else {
"✗ disabled"
};
let reasoning_status = if self.session.enable_reasoning_summary {
"✓ enabled"
} else {
"✗ disabled"
};
let extended_thinking_status = if self.session.enable_extended_thinking {
"✓ enabled"
} else {
"✗ disabled"
};
println!(" Web Search: {}", web_status);
println!(" Reasoning Summaries: {}", reasoning_status);
println!(" Reasoning Effort: {}", self.session.reasoning_effort);
println!(" Extended Thinking: {}", extended_thinking_status);
println!(
" Thinking Budget: {} tokens",
self.session.thinking_budget_tokens
);
// Show current tool status using enhanced display
let features = vec![
("Web Search", self.session.enable_web_search, Some("Search the web for up-to-date information")),
("Reasoning Summaries", self.session.enable_reasoning_summary, Some("Show reasoning process summaries")),
("Extended Thinking", self.session.enable_extended_thinking, Some("Enable deeper reasoning capabilities")),
];
self.display.print_feature_status(&features);
// Additional status information
self.display.print_info(&format!("Reasoning Effort: {}", self.session.reasoning_effort));
self.display.print_info(&format!("Thinking Budget: {} tokens", self.session.thinking_budget_tokens));
// Check model compatibility
let model = self.session.model.clone();

File diff suppressed because it is too large Load Diff