diagnostics: learn how to count column number with multibyte chars

So far diagnostics were cheating: in addition to the 'column' field of
locations (based on actual screen width per multibyte characters and
on tabulation expansion), the scanner sets the 'byte' field.
Diagnostics used this byte count to decide where to insert (color)
style.

We want to be able to truncate the quoted lines when there are too
wide to fit the screen.  This requires that the diagnostics learn how
to count columns, the byte-in-boundary trick no longer works.

Bytes are still used for fix-its.

* bootstrap.conf: We need mbfile for mbf_getc.
* src/location.c (caret_info): We need an mbfile.
(caret_set_file): Initialize it.
(caret_getc): Convert to mbfile.
(location_caret): Instead of relying on the byte position to decide
where to insert the color style, count the current column using
boundary_compute.
This commit is contained in:
Akim Demaille
2019-09-16 08:19:35 +02:00
parent 1ef407d923
commit 945b917da2
4 changed files with 44 additions and 28 deletions

3
m4/.gitignore vendored
View File

@@ -68,6 +68,7 @@
/isnand.m4
/isnanf.m4
/isnanl.m4
/iswblank.m4
/javacomp.m4
/javaexec.m4
/largefile.m4
@@ -92,6 +93,8 @@
/malloc.m4
/malloca.m4
/math_h.m4
/mbchar.m4
/mbfile.m4
/mbrtowc.m4
/mbsinit.m4
/mbstate_t.m4