summaryrefslogtreecommitdiffstats
path: root/src/diff.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-01-30 00:14:18 +0000
committerBram Moolenaar <Bram@vim.org>2006-01-30 00:14:18 +0000
commit280f126ef03c4e7d71d2c8341d661d3e37157851 (patch)
treed65ce0b9c87c5c0d04432cad5eafcbdbfebf0239 /src/diff.c
parent17c7c011706af19bb736c6815375f3b67a5646fc (diff)
updated for version 7.0189v7.0189
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c
index b0958548ae..22e18f3164 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1893,6 +1893,7 @@ ex_diffgetput(eap)
buf_T *buf;
int start_skip, end_skip;
int new_count;
+ int buf_empty;
/* Find the current buffer in the list of diff buffers. */
idx_cur = diff_buf_idx(curbuf);
@@ -2047,9 +2048,12 @@ ex_diffgetput(eap)
end_skip = 0;
}
+ buf_empty = FALSE;
added = 0;
for (i = 0; i < count; ++i)
{
+ /* remember deleting the last line of the buffer */
+ buf_empty = curbuf->b_ml.ml_line_count == 1;
ml_delete(lnum, FALSE);
--added;
}
@@ -2066,6 +2070,13 @@ ex_diffgetput(eap)
ml_append(lnum + i - 1, p, 0, FALSE);
vim_free(p);
++added;
+ if (buf_empty && curbuf->b_ml.ml_line_count == 2)
+ {
+ /* Added the first line into an empty buffer, need to
+ * delete the dummy empty line. */
+ buf_empty = FALSE;
+ ml_delete((linenr_T)2, FALSE);
+ }
}
}
new_count = dp->df_count[idx_to] + added;