diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-12-29 02:01:02 +0000 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-01-27 18:47:52 +0800 |
commit | 5864edac7be49a0cd0080a65330dd7661ffb5641 (patch) | |
tree | 3360d4cb093ca588b9a50a9b409ad85dab953109 /src/nvim/diff.c | |
parent | 3d0149f9848e22e7eb15652b1ec01d5920bd680a (diff) | |
download | rneovim-5864edac7be49a0cd0080a65330dd7661ffb5641.tar.gz rneovim-5864edac7be49a0cd0080a65330dd7661ffb5641.tar.bz2 rneovim-5864edac7be49a0cd0080a65330dd7661ffb5641.zip |
vim-patch:8.1.2302: :lockmarks does not work for '[ and ']
Problem: :lockmarks does not work for '[ and '].
Solution: save and restore '[ and '] marks. (James McCoy, closes vim/vim#5222)
https://github.com/vim/vim/commit/f4a1d1c0542df151bc59ac3b798ed198b5c71ccc
Test_diff_maintains_change_mark doesn't actually fail without these changes.
This is fixed in v8.2.3936.
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r-- | src/nvim/diff.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 340fec230c..233753839b 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -790,9 +790,14 @@ static int diff_write(buf_T *buf, diffin_T *din) // Always use 'fileformat' set to "unix". char_u *save_ff = buf->b_p_ff; buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); + const bool 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; int 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; |