feat: add support for negative column widths relative to terminal width
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -113,10 +113,19 @@ pub fn mode_list(
|
||||
|
||||
let mut meta_name: Option<&str> = None;
|
||||
|
||||
// Parse max_len, handling both numbers and percentages
|
||||
// Parse max_len, handling numbers, percentages, and negative values
|
||||
let column_width = if let Some(max_len_str) = &column.max_len {
|
||||
debug!("Processing max_len for column '{}': {}", column.name, max_len_str);
|
||||
if max_len_str.ends_with('%') {
|
||||
// Check if it's a negative number
|
||||
if max_len_str.starts_with('-') {
|
||||
// Parse as negative number
|
||||
let abs_value = max_len_str[1..].parse::<usize>().unwrap_or(0);
|
||||
if abs_value > term_width {
|
||||
0
|
||||
} else {
|
||||
term_width - abs_value
|
||||
}
|
||||
} else if max_len_str.ends_with('%') {
|
||||
// Parse percentage
|
||||
let percent_str = max_len_str.trim_end_matches('%');
|
||||
let percent = percent_str.parse::<f64>().unwrap_or(0.0);
|
||||
|
||||
Reference in New Issue
Block a user