-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
last decoration line is not formatted properly with --wrap never
#299
Comments
I'm using 0.6.1 on Arch Linux:
|
It seems that this section is the culprit: It simply prints the line as is, expecting that every line will be ended in a newline. But the last line can end without a newline, resulting in broken formatting. It is possible to look at the last character and print the missing newline if there isn't one: impl<'a> Printer for InteractivePrinter<'a> {
)).collect::<Vec<_>>()
.join("")
)?;
+
+ if line.bytes().next_back() != Some(0x0a) {
+ write!(handle, "\n")?;
+ }
} else {
for &(style, region) in regions.iter() {
let mut ansi_iterator = AnsiCodeIterator::new(region); If you are okay with such solution, I would be happy to create a pull request! |
Thank you for reporting this! Your fix looks good (I would prefer |
…d with a newline (fixes sharkdp#299)
Here you go: #300 |
Released in v0.7.0. |
This is a regression test for the fix for issue sharkdp#299. If that fix is reverted, currently only one test ('header_padding') fails. But that test is for a different use case, so add a dedicated regression test for the particular use case issue sharkdp#299 is about.
Example:
Compare that with
--wrap=character
(same input file):The text was updated successfully, but these errors were encountered: