aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index a7676e88f0..ae6c3f96e3 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -1622,7 +1622,8 @@ rewind_retry:
*ptr = NUL; /* end of line */
len = (colnr_T)(ptr - line_start + 1);
if (fileformat == EOL_DOS) {
- if (ptr[-1] == CAR) { /* remove CR */
+ if (ptr > line_start && ptr[-1] == CAR) {
+ // remove CR before NL
ptr[-1] = NUL;
len--;
} else if (ff_error != EOL_DOS) {