Mercurial > vim
diff src/register.c @ 18619:788d76db02ac v8.1.2302
patch 8.1.2302: :lockmarks does not work for '[ and ']
Commit: https://github.com/vim/vim/commit/f4a1d1c0542df151bc59ac3b798ed198b5c71ccc
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 16 13:50:25 2019 +0100
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 https://github.com/vim/vim/issues/5222)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 16 Nov 2019 14:00:05 +0100 |
parents | 9e6d5a4abb1c |
children | 50fde4e20790 |
line wrap: on
line diff
--- a/src/register.c +++ b/src/register.c @@ -1316,13 +1316,16 @@ op_yank(oparg_T *oap, int deleting, int } } - // Set "'[" and "']" marks. - curbuf->b_op_start = oap->start; - curbuf->b_op_end = oap->end; - if (yanktype == MLINE && !oap->block_mode) + if (!cmdmod.lockmarks) { - curbuf->b_op_start.col = 0; - curbuf->b_op_end.col = MAXCOL; + // Set "'[" and "']" marks. + curbuf->b_op_start = oap->start; + curbuf->b_op_end = oap->end; + if (yanktype == MLINE && !oap->block_mode) + { + curbuf->b_op_start.col = 0; + curbuf->b_op_end.col = MAXCOL; + } } #ifdef FEAT_CLIPBOARD @@ -1474,6 +1477,8 @@ do_put( char_u *insert_string = NULL; int allocated = FALSE; long cnt; + pos_T orig_start = curbuf->b_op_start; + pos_T orig_end = curbuf->b_op_end; #ifdef FEAT_CLIPBOARD // Adjust register name for "unnamed" in 'clipboard'. @@ -2100,6 +2105,11 @@ error: curwin->w_set_curswant = TRUE; end: + if (cmdmod.lockmarks) + { + curbuf->b_op_start = orig_start; + curbuf->b_op_end = orig_end; + } if (allocated) vim_free(insert_string); if (regname == '=')