diff options
-rw-r--r-- | editors/vi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/editors/vi.c b/editors/vi.c index da5f0a8c3..15ebe8dae 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2989,11 +2989,14 @@ static int file_insert(const char *fn, char *p, int initial) | |||
2989 | status_line_bold_errno(fn); | 2989 | status_line_bold_errno(fn); |
2990 | p = text_hole_delete(p, p + size - 1, NO_UNDO); // un-do buffer insert | 2990 | p = text_hole_delete(p, p + size - 1, NO_UNDO); // un-do buffer insert |
2991 | } else if (cnt < size) { | 2991 | } else if (cnt < size) { |
2992 | #if ENABLE_PLATFORM_MINGW32 | ||
2993 | // On WIN32 a partial read might just mean CRs have been removed | ||
2994 | int cnt_cr = cnt + count_cr(p, cnt); | ||
2995 | #endif | ||
2992 | // There was a partial read, shrink unused space | 2996 | // There was a partial read, shrink unused space |
2993 | p = text_hole_delete(p + cnt, p + size - 1, NO_UNDO); | 2997 | p = text_hole_delete(p + cnt, p + size - 1, NO_UNDO); |
2994 | #if ENABLE_PLATFORM_MINGW32 | 2998 | #if ENABLE_PLATFORM_MINGW32 |
2995 | // On WIN32 a partial read might just mean CRs have been removed | 2999 | if (cnt_cr < size) |
2996 | if (cnt + count_cr(p, cnt) < size) | ||
2997 | #endif | 3000 | #endif |
2998 | status_line_bold("can't read '%s'", fn); | 3001 | status_line_bold("can't read '%s'", fn); |
2999 | } | 3002 | } |