mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-26 22:59:38 +03:00
rcfile: allow alternate line endings in nanorc files
When copy-pasting has resulted in a nanorc file with DOS line endings (CR+LF), then silently ignore the carriage return, to avoid printing an error message that partly overwrites itself. This fulfills https://savannah.gnu.org/bugs/?57756. Requested-by: Matthias Aßhauer <mha1993@live.de>
This commit is contained in:
parent
f8d2f552bd
commit
98f038ad96
@ -1317,9 +1317,11 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
|
||||
if (just_syntax && !intros_only && lineno <= live_syntax->lineno)
|
||||
continue;
|
||||
#endif
|
||||
/* Strip the terminating newline, if any. */
|
||||
/* Strip the terminating newline and possibly a carriage return. */
|
||||
if (buffer[len - 1] == '\n')
|
||||
buffer[len - 1] = '\0';
|
||||
buffer[--len] = '\0';
|
||||
if (buffer[len - 1] == '\r')
|
||||
buffer[--len] = '\0';
|
||||
|
||||
ptr = buffer;
|
||||
while (isblank((unsigned char)*ptr))
|
||||
|
Loading…
Reference in New Issue
Block a user