From d957bd3273f1a281943e97aea08bc666dee17259 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 22 Sep 2021 21:04:15 -0700 Subject: Minor printing cleanups --- print.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/print.c b/print.c index 1926b63..e049ca1 100644 --- a/print.c +++ b/print.c @@ -37,10 +37,8 @@ static inline void print_line_number(FILE *out, printer_t *pr, size_t line_numbe else // Otherwise default to "wide enough for every line number in this file" for (int i = (int)pr->file->nlines; i > 0; i /= 10) ++space; - if (is_line_continued) { - for (space = abs(space); space > 0; --space) - fputc('.', out); - } else fprintf(out, "%*lu", space, line_number); + if (is_line_continued) fprintf(out, "%*s", abs(space), ""); + else fprintf(out, "%*lu", space, line_number); } else fputc(*c, out); } if (color) { @@ -66,8 +64,7 @@ static void print_between(FILE *out, printer_t *pr, const char *start, const cha fprintf(out, "%s", color); current_color = color; } - for (const char *c = start; c < eol; c++) - fputc(*c, out); + fwrite(start, sizeof(char), (size_t)(eol-start), out); if (eol[-1] == '\n') pr->needs_line_number = 1; start = eol; -- cgit v1.2.3