mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 11:55:56 +00:00
Make a little effort to treate CRLF as LF in config files. GitHub issue
3720.
This commit is contained in:
parent
b88130d24b
commit
4008e2ff6d
17
cmd-parse.y
17
cmd-parse.y
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user