diagnostics: truncate quoted sources to fit the screen

* src/location.c (min_int, columns): New.
(location_caret): Compute the line width.  Based on it, compute how
many columns must be skipped before the quoted location and truncated
after, to fit the sceen width.
* tests/local.at (AT_QUELL_VALGRIND): Transform into...
(AT_SET_ENV_IF, AT_SET_ENV): these.
Define COLUMNS to protect the test suite from the user's environment.
This commit is contained in:
Akim Demaille
2019-09-18 19:38:09 +02:00
parent 945b917da2
commit f716484627
3 changed files with 101 additions and 27 deletions

View File

@@ -118,7 +118,8 @@ unsigned location_print (location loc, FILE *out);
left-over by the usage of location_caret. */
void caret_free (void);
/* Output to OUT the line and caret corresponding to location LOC. */
/* Quote the line containing LOC onto OUT. Highlight the part of LOC
with the color STYLE. */
void location_caret (location loc, const char* style, FILE *out);
/* Return -1, 0, 1, depending whether a is before, equal, or