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.master
parent
85bffcfeb9
commit
c24432edc4
|
@ -3183,7 +3183,8 @@ void do_linter(void)
|
||||||
if ((tmplinecol = strtok(NULL, ",")) != NULL)
|
if ((tmplinecol = strtok(NULL, ",")) != NULL)
|
||||||
tmpcolno = strtol(tmplinecol, NULL, 10);
|
tmpcolno = strtol(tmplinecol, NULL, 10);
|
||||||
}
|
}
|
||||||
|
if (tmpcolno <= 0)
|
||||||
|
tmpcolno = 1;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "text.c:do_lint:Successful parse! %ld:%ld:%s\n", (long)tmplineno, (long)tmpcolno, message);
|
fprintf(stderr, "text.c:do_lint:Successful parse! %ld:%ld:%s\n", (long)tmplineno, (long)tmpcolno, message);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue