diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-09-22 21:04:15 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-09-22 21:04:15 -0700 |
| commit | d957bd3273f1a281943e97aea08bc666dee17259 (patch) | |
| tree | 25ffca202c5086f4d532f256f5c8fb4a55776a4b /print.c | |
| parent | 97b7befdc8b1721c13247d4905df51a7f9625b26 (diff) | |
Minor printing cleanups
Diffstat (limited to 'print.c')
| -rw-r--r-- | print.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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; |
