January 15, 2022
https://issues.dlang.org/show_bug.cgi?id=22678

          Issue ID: 22678
           Summary: -verrors=context does not account for tabs when
                    printing cursor
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: mrsmith33@yandex.ru

Example:
---
void main() {
        string a = 42; // single tab at the beginning
}
---

Currently prints:
---
test.d(2,13): Error: cannot implicitly convert expression 42 of type int to
string
        string a = 42; // tab is printed as is
            ^ // prints 1 space for the source tab
---

The diagnostic should instead be:
---
utf8error.d(3,21): Error: cannot implicitly convert expression 42 of type int
to string
        string a = 42; // tab is printed as is
                   ^ // prints tab for every tab in the source line
---

The issue is in this line: https://github.com/dlang/dmd/blob/1988acf9d0bedc8fe708e3e8009488e4d4f0e769/src/dmd/errors.d#L381

Currently it is:
---
fputc(' ', stderr);
---

but instead it should be:
---
if (u == '\t')
        fputc('\t', stderr);
else
        fputc(' ', stderr);
---

or
---
fputc(u == '\t' ? '\t' : ' ', stderr);
---

--