Skip to content

Commit 430bbfc

Browse files
committed
Exclude newline character from colorized output
Coloring the newline character results in the terminal cursor becoming colored when the final line in the interdiff is colored. Fix this by not coloring the newline character.
1 parent dcd431d commit 430bbfc

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/interdiff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,8 @@ trim_context (FILE *f /* positioned at start of @@ line */,
11431143
fwrite (line, (size_t) got, 1, out);
11441144
continue;
11451145
}
1146-
print_color (out, type, "%s", line);
1146+
print_color (out, type, "%.*s", (int) got - 1, line);
1147+
fputc ('\n', out);
11471148
}
11481149
}
11491150

0 commit comments

Comments
 (0)