[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/11] diagnostics: don't print ellipsis on the caret line
From: |
Akim Demaille |
Subject: |
[PATCH 10/11] diagnostics: don't print ellipsis on the caret line |
Date: |
Sat, 21 Sep 2019 12:00:03 +0200 |
From
9 | ...TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKL
| ... ^~~~~~~~~~~~~~~~~~~~~~~~~~
to
9 | ...TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHI...
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
* src/location.c (location_caret): here.
* tests/diagnostics.at: Adjust expectations.
---
src/location.c | 5 ++---
tests/diagnostics.at | 6 +++---
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/location.c b/src/location.c
index b0d9f015..a7824557 100644
--- a/src/location.c
+++ b/src/location.c
@@ -388,9 +388,8 @@ location_caret (location loc, const char *style, FILE *out)
/* Print the carets with the same indentation as above. */
{
- fprintf (out, " | %s%*s",
- skip ? "..." : "",
- loc.start.column - 1 - skip, "");
+ fprintf (out, " | %*s",
+ loc.start.column - 1 - skip + (skip ? 3 : 0), "");
begin_use_class (style, out);
putc ('^', out);
/* Underlining a multiline location ends with the first
diff --git a/tests/diagnostics.at b/tests/diagnostics.at
index 5eba7bad..03960d5f 100644
--- a/tests/diagnostics.at
+++ b/tests/diagnostics.at
@@ -363,7 +363,7 @@ input.y:9.8-33: previous declaration
| <note>^~~~~~~~~~~~~~~~~~~~~~~~~~</note>
input.y:9.92-117: <warning>warning:</warning> symbol
ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [<warning>-Wother</warning>]
9 | ...TUVWXYZ <warning>ABCDEFGHIJKLMNOPQRSTUVWXYZ</warning>
- | ... <warning>^~~~~~~~~~~~~~~~~~~~~~~~~~</warning>
+ | <warning>^~~~~~~~~~~~~~~~~~~~~~~~~~</warning>
input.y:9.8-33: previous declaration
9 | %token <note>ABCDEFGHIJKLMNOPQRSTUVWXYZ</note>
ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEF...
| <note>^~~~~~~~~~~~~~~~~~~~~~~~~~</note>
@@ -384,13 +384,13 @@ input.y:9.8-33: previous declaration
| <note>^~~~~~~~~~~~~~~~~~~~~~~~~~</note>
input.y:9.64-89: <warning>warning:</warning> symbol ABCDEFGHIJKLMNOPQRSTUVWXYZ
redeclared [<warning>-Wother</warning>]
9 | ...TUVWXYZ <warning>ABCDEFGHIJKLMNOPQRSTUVWXYZ</warning> ABCDEFGHI...
- | ... <warning>^~~~~~~~~~~~~~~~~~~~~~~~~~</warning>
+ | <warning>^~~~~~~~~~~~~~~~~~~~~~~~~~</warning>
input.y:9.8-33: previous declaration
9 | %token <note>ABCDEFGHIJKLMNOPQRSTUVWXYZ</note> ABCDEFGHIJKLMN...
| <note>^~~~~~~~~~~~~~~~~~~~~~~~~~</note>
input.y:9.92-117: <warning>warning:</warning> symbol
ABCDEFGHIJKLMNOPQRSTUVWXYZ redeclared [<warning>-Wother</warning>]
9 | ...TUVWXYZ <warning>ABCDEFGHIJKLMNOPQRSTUVWXYZ</warning>
- | ... <warning>^~~~~~~~~~~~~~~~~~~~~~~~~~</warning>
+ | <warning>^~~~~~~~~~~~~~~~~~~~~~~~~~</warning>
input.y:9.8-33: previous declaration
9 | %token <note>ABCDEFGHIJKLMNOPQRSTUVWXYZ</note> ABCDEFGHIJKLMN...
| <note>^~~~~~~~~~~~~~~~~~~~~~~~~~</note>
--
2.23.0
- [PATCH 00/11] diagnostics: truncate quoted sources to fit the screen width, Akim Demaille, 2019/09/21
- [PATCH 01/11] diagnostics: style: minor changes, Akim Demaille, 2019/09/21
- [PATCH 04/11] diagnostics: style: use a boundary to track the caret_info, Akim Demaille, 2019/09/21
- [PATCH 02/11] diagnostics: style: add caret_set_file, Akim Demaille, 2019/09/21
- [PATCH 07/11] diagnostics: truncate quoted sources to fit the screen, Akim Demaille, 2019/09/21
- [PATCH 03/11] diagnostics: extract boundary_compute from location_compute, Akim Demaille, 2019/09/21
- [PATCH 06/11] diagnostics: learn how to count column number with multibyte chars, Akim Demaille, 2019/09/21
- [PATCH 05/11] diagnostics: style: rename member for clariy, Akim Demaille, 2019/09/21
- [PATCH 09/11] diagnostics: also show truncation at the end of line with "...", Akim Demaille, 2019/09/21
- [PATCH 10/11] diagnostics: don't print ellipsis on the caret line,
Akim Demaille <=
- [PATCH 11/11] diagnostics: get the screen width from the terminal, Akim Demaille, 2019/09/21
- [PATCH 08/11] diagnostics: check that quoted lines are truncated, Akim Demaille, 2019/09/21
- [PATCH 11/11] diagnotics: get the screen width from the terminal, Akim Demaille, 2019/09/21