arocc icon indicating copy to clipboard operation
arocc copied to clipboard

Account for tabs when printing diagnostic caret

Open ehaas opened this issue 4 years ago • 1 comments

Currently tabs are treated as having a width of 1, which means the diagnostic caret is misaligned if the line contains any tabs before the location being indicated.

I don't think there's a reliable way to get the tab width; it seems that gcc and clang just print tabs as a fixed number of spaces (gcc by default seems to use 2, clang uses 8).

ehaas avatar Dec 09 '21 19:12 ehaas

I don't think there's a reliable way to get the tab width; it seems that gcc and clang just print tabs as a fixed number of spaces (gcc by default seems to use 2, clang uses 8).

The standard does not specify one, but one could use the .editorconfig, see https://editorconfig.org/ "indent_style = space, indent_size = 4". The editorconfig has no way to define a correct encoding in all cases (ie utf16-le-bom etc not possible).

matu3ba avatar Nov 30 '23 15:11 matu3ba