Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,14 @@ pub fn ansi_trim_end(s: &str) -> String {
if trimmed_width == UnicodeWidthStr::width(stripped.as_ref()) {
return s.to_string();
}
truncate(s, trimmed_width).into_owned()
// Truncating drops any ANSI reset code that was at the end of the original
// string, which leaves color/style open in the terminal. Append an explicit
// reset so every trimmed line always ends in a clean state.
let mut result = truncate(s, trimmed_width).into_owned();
if stripped.as_ref() != s {
result.push_str("\x1b[0m");
}
result
}

pub fn find_column_kind(pat: &str) -> Option<ConfigColumnKind> {
Expand Down