From c24432edc41266ef60ab6d1d29a1fdccca0ce338 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 26 Jul 2017 21:23:31 +0200 Subject: [PATCH] linting: don't try to put the cursor at a negative x position Human column numbers are one-based, whereas x positions are zero-based. Converting from the one to the other involves subtracting one. But when the linter message does not provide a column number, the latter defaults to zero. Catch that case and change the number to one. This fixes https://savannah.gnu.org/bugs/?51550. --- src/text.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/text.c b/src/text.c index 33a12d7c..1b97403d 100644 --- a/src/text.c +++ b/src/text.c @@ -3183,7 +3183,8 @@ void do_linter(void) if ((tmplinecol = strtok(NULL, ",")) != NULL) tmpcolno = strtol(tmplinecol, NULL, 10); } - + if (tmpcolno <= 0) + tmpcolno = 1; #ifdef DEBUG fprintf(stderr, "text.c:do_lint:Successful parse! %ld:%ld:%s\n", (long)tmplineno, (long)tmpcolno, message); #endif