[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[COMMITTED] pkl: Fix diags for code in buffers
From: |
Mohammad-Reza Nabipoor |
Subject: |
[COMMITTED] pkl: Fix diags for code in buffers |
Date: |
Mon, 14 Mar 2022 17:30:14 +0330 |
2022-03-14 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
* libpoke/pkl-diag.c (pkl_detailed_location): Fix printing
diagnostics for codes in buffers.
---
ChangeLog | 5 +++++
libpoke/pkl-diag.c | 10 +++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3fe58036..4653663c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-03-14 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
+
+ * libpoke/pkl-diag.c (pkl_detailed_location): Fix printing
+ diagnostics for codes in buffers.
+
2022-03-12 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
* poked/poked.pk (poked_ehandler): Remove extra newline.
diff --git a/libpoke/pkl-diag.c b/libpoke/pkl-diag.c
index 49519d3a..65eb3c17 100644
--- a/libpoke/pkl-diag.c
+++ b/libpoke/pkl-diag.c
@@ -88,7 +88,7 @@ pkl_detailed_location (pkl_ast ast, pkl_ast_loc loc,
{
/* Print until newline or end of string. Note that we
are normalizing tabs to spaces so the error location
- wont' appear displaed. */
+ wont' appear displaced. */
do
{
if (c == '\t')
@@ -123,9 +123,13 @@ pkl_detailed_location (pkl_ast ast, pkl_ast_loc loc,
if (cur_line >= loc.first_line
&& cur_line <= loc.last_line)
{
- /* Print until newline or end of string. */
+ /* Print until newline or end of string. Note that we
+ are normalizing tabs to spaces so the error location
+ wont' appear displaced. */
+ if (*p == '\n')
+ ++p;
for (;*p != '\0' && *p != '\n'; ++p)
- pk_printf ("%c", *p);
+ pk_printf ("%c", *p == '\t' ? ' ' : *p);
break;
}
}
--
2.35.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [COMMITTED] pkl: Fix diags for code in buffers,
Mohammad-Reza Nabipoor <=