Make a little effort to treate CRLF as LF in config files. GitHub issue

3720.
This commit is contained in:
nicm 2024-08-04 09:42:23 +00:00
parent b88130d24b
commit 4008e2ff6d
2 changed files with 17 additions and 1 deletions

View File

@ -1273,6 +1273,16 @@ yylex(void)
continue;
}
if (ch == '\r') {
/*
* Treat \r\n as \n.
*/
ch = yylex_getc();
if (ch != '\n') {
yylex_ungetc(ch);
ch = '\r';
}
}
if (ch == '\n') {
/*
* End of line. Update the line number.
@ -1619,6 +1629,13 @@ yylex_token(int ch)
log_debug("%s: end at EOF", __func__);
break;
}
if (state == NONE && ch == '\r') {
ch = yylex_getc();
if (ch != '\n') {
yylex_ungetc(ch);
ch = '\r';
}
}
if (state == NONE && ch == '\n') {
log_debug("%s: end at EOL", __func__);
break;

1
tty.c
View File

@ -2656,7 +2656,6 @@ static void
tty_colours(struct tty *tty, const struct grid_cell *gc)
{
struct grid_cell *tc = &tty->cell;
int have_ax;
/* No changes? Nothing is necessary. */
if (gc->fg == tc->fg && gc->bg == tc->bg && gc->us == tc->us)