diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-11-16 13:50:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-11-16 13:50:25 +0100 |
commit | f4a1d1c0542df151bc59ac3b798ed198b5c71ccc (patch) | |
tree | 9f6051c5c5e75c7f113a923f7888f0f272ddee9e /src/bufwrite.c | |
parent | ab85ca4e6a40b2998db7b00896505486f5c16b41 (diff) | |
download | vim-git-f4a1d1c0542df151bc59ac3b798ed198b5c71ccc.tar.gz |
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/bufwrite.c')
-rw-r--r-- | src/bufwrite.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bufwrite.c b/src/bufwrite.c index 13091a336..8393df1a0 100644 --- a/src/bufwrite.c +++ b/src/bufwrite.c @@ -683,6 +683,8 @@ buf_write( context_sha256_T sha_ctx; #endif unsigned int bkc = get_bkc_value(buf); + pos_T orig_start = buf->b_op_start; + pos_T orig_end = buf->b_op_end; if (fname == NULL || *fname == NUL) // safety check return FAIL; @@ -875,6 +877,13 @@ buf_write( #endif ) { + if (buf != NULL && cmdmod.lockmarks) + { + // restore the original '[ and '] positions + buf->b_op_start = orig_start; + buf->b_op_end = orig_end; + } + --no_wait_return; msg_scroll = msg_save; if (nofile_err) @@ -952,6 +961,13 @@ buf_write( fname = buf->b_sfname; } + if (cmdmod.lockmarks) + { + // restore the original '[ and '] positions + buf->b_op_start = orig_start; + buf->b_op_end = orig_end; + } + #ifdef FEAT_NETBEANS_INTG if (netbeans_active() && isNetbeansBuffer(buf)) { |