1
0
mirror of https://github.com/tmux/tmux.git synced 2025-03-25 07:18:48 +00:00

Count line numbers correctly inside strings, reported by Pedro Navarro

in GitHub issue 4325.
This commit is contained in:
nicm 2025-01-13 08:58:34 +00:00
parent 97fe3563fa
commit 31e8d4676a

View File

@ -1627,6 +1627,7 @@ yylex_token_tilde(char **buf, size_t *len)
static char *
yylex_token(int ch)
{
struct cmd_parse_state *ps = &parse_state;
char *buf;
size_t len;
enum { START,
@ -1650,9 +1651,12 @@ yylex_token(int ch)
ch = '\r';
}
}
if (state == NONE && ch == '\n') {
log_debug("%s: end at EOL", __func__);
break;
if (ch == '\n') {
if (state == NONE) {
log_debug("%s: end at EOL", __func__);
break;
}
ps->input->line++;
}
/* Whitespace or ; or } ends a token unless inside quotes. */