function old new delta file_insert 390 391 +1
Signed-off-by: Petja Patjas <[email protected]> --- editors/vi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/editors/vi.c b/editors/vi.c index f48bcf514..06d446970 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2012,16 +2012,16 @@ static int file_insert(const char *fn, char *p, int initial) if (cnt < 0) { status_line_bold_errno(fn); p = text_hole_delete(p, p + size - 1, NO_UNDO); // un-do buffer insert - } else if (cnt < size) { - // There was a partial read, shrink unused space - p = text_hole_delete(p + cnt, p + size - 1, NO_UNDO); - status_line_bold("can't read '%s'", fn); - } + } else { + if (cnt < size) { + // There was a partial read, shrink unused space + text_hole_delete(p + cnt, p + size - 1, NO_UNDO); + status_line_bold("can't read '%s'", fn); + } # if ENABLE_FEATURE_VI_UNDO - else { - undo_push_insert(p, size, ALLOW_UNDO); - } + undo_push_insert(p, cnt, ALLOW_UNDO); # endif + } fi: close(fd); -- 2.51.0 _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
