tweaks: don't bother overwriting a CR -- decreasing the length is enough

The string of bytes get properly terminated by encode_data(); there is
no need to do that earlier.
master
Benno Schulenberg 2020-05-13 10:31:39 +02:00
parent 56bf29409b
commit fe94999c1c
1 changed files with 2 additions and 2 deletions

View File

@ -682,14 +682,14 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
if (input == '\n') {
#ifndef NANO_TINY
if (len > 0 && buf[len - 1] == '\r' && !ISSET(NO_CONVERT)) {
buf[--len] = '\0';
if (num_lines == 0)
format = 1;
len--;
}
} else if ((num_lines == 0 || format == 2) && !ISSET(NO_CONVERT) &&
len > 0 && buf[len - 1] == '\r') {
buf[--len] = '\0';
format = 2;
len--;
#endif
} else {
/* Store the byte. */