aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-07-14 20:07:58 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-07-15 23:07:29 -0400
commitbf919454ebb40a190dba99cf67549006292a9709 (patch)
tree97df37dc874c1d5de6d3524e23becb172a2d4813 /src/nvim/normal.c
parent5be40b9aadbb313cd4bb8198d9e252b6469f522f (diff)
downloadrneovim-bf919454ebb40a190dba99cf67549006292a9709.tar.gz
rneovim-bf919454ebb40a190dba99cf67549006292a9709.tar.bz2
rneovim-bf919454ebb40a190dba99cf67549006292a9709.zip
vim-patch:8.1.0686: when 'y' is in 'cpoptions' yanking for the clipboard changes redo
Problem: When 'y' is in 'cpoptions' yanking for the clipboard changes redo. Solution: Do not use the 'y' flag when "gui_yank" is TRUE. (Andy Massimino, closes vim/vim#3760) https://github.com/vim/vim/commit/5823f84dd04198994e3e5f2e278a5e315c47d32d
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index de8ff52fe1..4ef4b69def 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -1376,9 +1376,8 @@ static void set_vcount_ca(cmdarg_T *cap, bool *set_prevcount)
*set_prevcount = false; /* only set v:prevcount once */
}
-/*
- * Handle an operator after visual mode or when the movement is finished
- */
+// Handle an operator after Visual mode or when the movement is finished.
+// "gui_yank" is true when yanking text for the clipboard.
void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
{
oparg_T *oap = cap->oap;
@@ -1402,8 +1401,12 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
* If an operation is pending, handle it...
*/
if ((finish_op
- || VIsual_active
- ) && oap->op_type != OP_NOP) {
+ || VIsual_active)
+ && oap->op_type != OP_NOP) {
+ // Yank can be redone when 'y' is in 'cpoptions', but not when yanking
+ // for the clipboard.
+ const bool redo_yank = vim_strchr(p_cpo, CPO_YANK) != NULL && !gui_yank;
+
// Avoid a problem with unwanted linebreaks in block mode
if (curwin->w_p_lbr) {
curwin->w_valid &= ~VALID_VIRTCOL;
@@ -1433,9 +1436,9 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
VIsual_reselect = false;
}
- /* Only redo yank when 'y' flag is in 'cpoptions'. */
- /* Never redo "zf" (define fold). */
- if ((vim_strchr(p_cpo, CPO_YANK) != NULL || oap->op_type != OP_YANK)
+ // Only redo yank when 'y' flag is in 'cpoptions'.
+ // Never redo "zf" (define fold).
+ if ((redo_yank || oap->op_type != OP_YANK)
&& ((!VIsual_active || oap->motion_force)
// Also redo Operator-pending Visual mode mappings.
|| (cap->cmdchar == ':' && oap->op_type != OP_COLON))
@@ -1608,8 +1611,8 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
resel_VIsual_line_count = oap->line_count;
}
- /* can't redo yank (unless 'y' is in 'cpoptions') and ":" */
- if ((vim_strchr(p_cpo, CPO_YANK) != NULL || oap->op_type != OP_YANK)
+ // can't redo yank (unless 'y' is in 'cpoptions') and ":"
+ if ((redo_yank || oap->op_type != OP_YANK)
&& oap->op_type != OP_COLON
&& oap->op_type != OP_FOLD
&& oap->op_type != OP_FOLDOPEN