diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 00:32:39 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-18 00:32:39 -0800 |
| commit | 2615a3b9f21701866bfc4bdf9df24044587a6e92 (patch) | |
| tree | 46f852bfec72a5a6a2678e1085d4f9918d6bd48b /files.c | |
| parent | dfdc7bf94a6ec3e5362eb2982d5c5c31edee4239 (diff) | |
Hacky fix for tabs misaligning error printing
Diffstat (limited to 'files.c')
| -rw-r--r-- | files.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -228,11 +228,16 @@ void fprint_line(FILE *dest, file_t *f, const char *start, const char *end, cons (int)charnum - 1, line, (int)(end - &line[charnum-1]), &line[charnum-1], (int)(eol - end - 1), end); - fprintf(dest, " \033[34;1m"); - const char *p = line - 1; - for (; p < start; ++p) fputc(' ', dest); + fprintf(dest, " \033[34;1m"); + const char *p = line; + for (; p < start; ++p) fputc(*p == '\t' ? '\t' : ' ', dest); if (start == end) ++end; - for (; p < end; ++p) fputc('^', dest); + for (; p < end; ++p) + if (*p == '\t') + // Some janky hacks: 8 ^'s, backtrack 8 spaces, move forward a tab stop, clear any ^'s that overshot + fprintf(dest, "^^^^^^^^\033[8D\033[I\033[K"); + else + fputc('^', dest); fprintf(dest, "\033[0m\n"); } |
