diff --git a/src/modes/list.rs b/src/modes/list.rs index c65c57c..759b04f 100644 --- a/src/modes/list.rs +++ b/src/modes/list.rs @@ -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::().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::().unwrap_or(0.0);