summaryrefslogtreecommitdiffstats
path: root/src/diff.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-16 13:50:25 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-16 13:50:25 +0100
commitf4a1d1c0542df151bc59ac3b798ed198b5c71ccc (patch)
tree9f6051c5c5e75c7f113a923f7888f0f272ddee9e /src/diff.c
parentab85ca4e6a40b2998db7b00896505486f5c16b41 (diff)
patch 8.1.2302: :lockmarks does not work for '[ and ']v8.1.2302
Problem: :lockmarks does not work for '[ and ']. Solution: save and restore '[ and '] marks. (James McCoy, closes #5222)
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c
index b16f7b6f3e..dd5fb22f40 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -772,6 +772,7 @@ diff_write(buf_T *buf, diffin_T *din)
{
int r;
char_u *save_ff;
+ int save_lockmarks;
if (din->din_fname == NULL)
return diff_write_buffer(buf, din);
@@ -779,9 +780,14 @@ diff_write(buf_T *buf, diffin_T *din)
// Always use 'fileformat' set to "unix".
save_ff = buf->b_p_ff;
buf->b_p_ff = vim_strsave((char_u *)FF_UNIX);
+ save_lockmarks = cmdmod.lockmarks;
+ // Writing the buffer is an implementation detail of performing the diff,
+ // so it shouldn't update the '[ and '] marks.
+ cmdmod.lockmarks = TRUE;
r = buf_write(buf, din->din_fname, NULL,
(linenr_T)1, buf->b_ml.ml_line_count,
NULL, FALSE, FALSE, FALSE, TRUE);
+ cmdmod.lockmarks = save_lockmarks;
free_string_option(buf->b_p_ff);
buf->b_p_ff = save_ff;
return r;