mirror of
git://git.sv.gnu.org/nano.git
synced 2025-02-09 01:44:32 +03:00
files: do not let a stray CR in a DOS file trigger Mac format
Only when a CR is seen before any LF, and the CR is not followed by a LF, should this CR be interpreted as a line separator. And only then the file should be reported as being in Mac format -- as long as --noconvert is not used. This fixes https://savannah.gnu.org/bugs/?58357. Bug existed since at least version 2.0.6.
This commit is contained in:
parent
0a1817e893
commit
ac0f2c9485
@ -683,7 +683,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
|
||||
if ((num_lines == 0 || format != 0) && !ISSET(NO_CONVERT) &&
|
||||
len > 0 && buf[len - 1] == '\r')
|
||||
format |= 1;
|
||||
} else if ((num_lines == 0 || format != 0) && !ISSET(NO_CONVERT) &&
|
||||
} else if ((num_lines == 0 || format == 2) && !ISSET(NO_CONVERT) &&
|
||||
len > 0 && buf[len - 1] == '\r') {
|
||||
format |= 2;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user