diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-05-06 19:26:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 19:26:28 +0800 |
commit | 7978660efb087583a1ac49c70588d72af80de6d7 (patch) | |
tree | 505dbb2a886447710408fb46522084da305f3628 /src/nvim/normal.c | |
parent | 8bbeab9989d5f905ce2e4512e9967ee99d859f70 (diff) | |
download | rneovim-7978660efb087583a1ac49c70588d72af80de6d7.tar.gz rneovim-7978660efb087583a1ac49c70588d72af80de6d7.tar.bz2 rneovim-7978660efb087583a1ac49c70588d72af80de6d7.zip |
vim-patch:8.2.4881: "P" in Visual mode still changes some registers (#18445)
Problem: "P" in Visual mode still changes some registers.
Solution: Make "P" in Visual mode not change any register. (Shougo
Matsushita, closes vim/vim#10349)
https://github.com/vim/vim/commit/509142ab7a9db32114b6d0949722b9133c9c22f2
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 2eb3c4be72..81c95ec77f 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -7108,7 +7108,7 @@ static void nv_put_opt(cmdarg_T *cap, bool fix_indent) // overwrites if the old contents is being put. was_visual = true; regname = cap->oap->regname; - bool save_unnamed = cap->cmdchar == 'P'; + bool keep_registers = cap->cmdchar == 'P'; // '+' and '*' could be the same selection bool clipoverwrite = (regname == '+' || regname == '*') && (cb_flags & CB_UNNAMEDMASK); if (regname == 0 || regname == '"' || clipoverwrite @@ -7123,23 +7123,15 @@ static void nv_put_opt(cmdarg_T *cap, bool fix_indent) // do_put(), which requires the visual selection to still be active. if (!VIsual_active || VIsual_mode == 'V' || regname != '.') { // Now delete the selected text. Avoid messages here. - yankreg_T *old_y_previous; - if (save_unnamed) { - old_y_previous = get_y_previous(); - } cap->cmdchar = 'd'; cap->nchar = NUL; - cap->oap->regname = NUL; + cap->oap->regname = keep_registers ? '_' : NUL; msg_silent++; nv_operator(cap); do_pending_operator(cap, 0, false); empty = (curbuf->b_ml.ml_flags & ML_EMPTY); msg_silent--; - if (save_unnamed) { - set_y_previous(old_y_previous); - } - // delete PUT_LINE_BACKWARD; cap->oap->regname = regname; } |