fix: Truncate all info table value cells and add debug logging
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -3,7 +3,7 @@ use crate::compression_engine::CompressionType;
|
||||
use crate::meta_plugin::MetaPluginType;
|
||||
use clap::Command;
|
||||
use clap::error::ErrorKind;
|
||||
use log::debug;
|
||||
use log::{debug, log_enabled, Level};
|
||||
use prettytable::format::TableFormat;
|
||||
use regex::Regex;
|
||||
use std::collections::HashMap;
|
||||
@@ -247,17 +247,22 @@ pub fn calculate_last_column_width(column_widths: &[usize], terminal_width: usiz
|
||||
|
||||
/// Truncate a string to fit within a maximum width, adding an ellipsis if truncated
|
||||
pub fn truncate_with_ellipsis(s: &str, max_width: usize) -> String {
|
||||
debug!("Truncating '{}' to max_width: {}", s, max_width);
|
||||
if max_width == 0 {
|
||||
debug!("Max width is 0, returning empty string");
|
||||
return String::new();
|
||||
}
|
||||
|
||||
if s.chars().count() <= max_width {
|
||||
let char_count = s.chars().count();
|
||||
if char_count <= max_width {
|
||||
debug!("String fits within max_width ({} <= {}), returning original", char_count, max_width);
|
||||
return s.to_string();
|
||||
}
|
||||
|
||||
// We need to truncate and add an ellipsis
|
||||
// The ellipsis takes 1 character, so we can show max_width-1 characters
|
||||
if max_width == 1 {
|
||||
debug!("Max width is 1, returning ellipsis only");
|
||||
return "…".to_string();
|
||||
}
|
||||
|
||||
@@ -273,5 +278,6 @@ pub fn truncate_with_ellipsis(s: &str, max_width: usize) -> String {
|
||||
}
|
||||
|
||||
result.push('…');
|
||||
debug!("Truncated result: '{}'", result);
|
||||
result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user