fix: 3 bugs from peer code review
- justify: gate DIM/RESET separator coloring on color_enabled param; previously leaked ANSI escapes when --color=never or NO_COLOR was set - vcs: apply branch name truncation per config (truncate.enabled, truncate.max, truncate.style) for both git and jj renderers; previously ignored truncate config causing long branch names to overflow and trigger unnecessary priority drops - flex: account for prefix/suffix overhead when computing context_bar flex expansion width; previously double-applied apply_formatting causing line to overshoot term_width when prefix/suffix configured Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ pub fn justify(
|
||||
term_width: u16,
|
||||
separator: &str,
|
||||
_mode: JustifyMode,
|
||||
color_enabled: bool,
|
||||
) -> String {
|
||||
let content_width: usize = active
|
||||
.iter()
|
||||
@@ -37,11 +38,15 @@ pub fn justify(
|
||||
if i > 0 {
|
||||
let this_gap = gap_width + usize::from(i - 1 < gap_remainder);
|
||||
let gap_str = build_gap(sep_core, sep_core_len, this_gap);
|
||||
output.push_str(&format!(
|
||||
"{}{gap_str}{}",
|
||||
crate::color::DIM,
|
||||
crate::color::RESET
|
||||
));
|
||||
if color_enabled {
|
||||
output.push_str(&format!(
|
||||
"{}{gap_str}{}",
|
||||
crate::color::DIM,
|
||||
crate::color::RESET
|
||||
));
|
||||
} else {
|
||||
output.push_str(&gap_str);
|
||||
}
|
||||
}
|
||||
output.push_str(&sec.output.ansi);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user