diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-02-09 20:46:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-09 20:46:30 +0800 |
commit | 60e3940b4a94b2d089147579c7d62747543f0385 (patch) | |
tree | 0a7034bf1eacbc7508876e4e5558655c20e28d09 /src/nvim/normal.c | |
parent | 3959f3a9c8aa040f3562b0a5fd442c9c2f0a4f9a (diff) | |
parent | 3fe47647c7b902d882d3d72158f2712490506a75 (diff) | |
download | rneovim-60e3940b4a94b2d089147579c7d62747543f0385.tar.gz rneovim-60e3940b4a94b2d089147579c7d62747543f0385.tar.bz2 rneovim-60e3940b4a94b2d089147579c7d62747543f0385.zip |
Merge pull request #17346 from zeertzjq/vim-8.2.4242
vim-patch:8.2.{4242,4315}: put in Visual mode cannot be repeated
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 225c66aae1..21c465434a 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -7509,9 +7509,9 @@ 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'; // '+' and '*' could be the same selection - bool clipoverwrite = (regname == '+' || regname == '*') - && (cb_flags & CB_UNNAMEDMASK); + bool clipoverwrite = (regname == '+' || regname == '*') && (cb_flags & CB_UNNAMEDMASK); if (regname == 0 || regname == '"' || clipoverwrite || ascii_isdigit(regname) || regname == '-') { // The delete might overwrite the register we want to put, save it first @@ -7524,6 +7524,10 @@ 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; @@ -7533,6 +7537,10 @@ static void nv_put_opt(cmdarg_T *cap, bool fix_indent) 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; } |