Skip to content

Commit

Permalink
Add reset ANSI code to the end of commands when displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
crdx committed Jan 16, 2023
1 parent 6c39403 commit 1d7f53f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ impl<'a> fmt::Display for Command<'a> {
if self.line_count > 1 {
write!(
formatter,
"{} [... TRUNCATED: {} more line(s) ...]",
"{}\x1b[0m [... TRUNCATED: {} more line(s) ...]",
first_line,
self.line_count - 1
)
} else {
write!(formatter, "{}", first_line)
write!(formatter, "{}\x1b[0m", first_line)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ mod tests {

assert_eq!(
from_utf8(&stdout).unwrap(),
"1\t2021-06-27 20:49:55\tcommand1\n2\t2021-06-27 20:50:00\tcommand2\n"
"1\t2021-06-27 20:49:55\tcommand1\x1b[0m\n2\t2021-06-27 20:50:00\tcommand2\x1b[0m\n"
);
}

Expand All @@ -98,7 +98,7 @@ mod tests {

assert_eq!(
from_utf8(&stdout).unwrap(),
"1\t2021-06-27 20:49:55\tcommand1line1 [... TRUNCATED: 1 more line(s) ...]\n2\t2021-06-27 20:50:00\tcommand2\n"
"1\t2021-06-27 20:49:55\tcommand1line1\x1b[0m [... TRUNCATED: 1 more line(s) ...]\n2\t2021-06-27 20:50:00\tcommand2\x1b[0m\n"
);
}
}

0 comments on commit 1d7f53f

Please sign in to comment.