diagnostics: give m4 precise locations

Currently we pass only the columns based on the screen-width, which is
important for the carets.  But we don't pass the bytes-based columns,
which is important for the colors.  Pass both.

* src/muscle-tab.c (muscle_boundary_grow): Also pass the byte-based column.
* src/location.c (location_caret): Clarify.
(boundary_set_from_string): Adjust to the new format.
* tests/diagnostics.at (Tabulations and multibyte characters from M4): New.
This commit is contained in:
Akim Demaille
2019-04-27 16:29:07 +02:00
parent a514c51e55
commit 386cf25088
4 changed files with 65 additions and 25 deletions

View File

@@ -275,7 +275,7 @@ muscle_boundary_grow (char const *key, boundary bound)
{
obstack_sgrow (&muscle_obstack, "[[");
obstack_escape (&muscle_obstack, bound.file);
obstack_printf (&muscle_obstack, ":%d.%d]]", bound.line, bound.column);
obstack_printf (&muscle_obstack, ":%d.%d@@%d]]", bound.line, bound.column, bound.byte);
char const *extension = obstack_finish0 (&muscle_obstack);
muscle_grow (key, extension, "", "");
obstack_free (&muscle_obstack, extension);