mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
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)
5823f84dd0
This commit is contained in:
@@ -1376,9 +1376,8 @@ static void set_vcount_ca(cmdarg_T *cap, bool *set_prevcount)
|
|||||||
*set_prevcount = false; /* only set v:prevcount once */
|
*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)
|
void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
||||||
{
|
{
|
||||||
oparg_T *oap = cap->oap;
|
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 an operation is pending, handle it...
|
||||||
*/
|
*/
|
||||||
if ((finish_op
|
if ((finish_op
|
||||||
|| VIsual_active
|
|| VIsual_active)
|
||||||
) && oap->op_type != OP_NOP) {
|
&& 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
|
// Avoid a problem with unwanted linebreaks in block mode
|
||||||
if (curwin->w_p_lbr) {
|
if (curwin->w_p_lbr) {
|
||||||
curwin->w_valid &= ~VALID_VIRTCOL;
|
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;
|
VIsual_reselect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only redo yank when 'y' flag is in 'cpoptions'. */
|
// Only redo yank when 'y' flag is in 'cpoptions'.
|
||||||
/* Never redo "zf" (define fold). */
|
// Never redo "zf" (define fold).
|
||||||
if ((vim_strchr(p_cpo, CPO_YANK) != NULL || oap->op_type != OP_YANK)
|
if ((redo_yank || oap->op_type != OP_YANK)
|
||||||
&& ((!VIsual_active || oap->motion_force)
|
&& ((!VIsual_active || oap->motion_force)
|
||||||
// Also redo Operator-pending Visual mode mappings.
|
// Also redo Operator-pending Visual mode mappings.
|
||||||
|| (cap->cmdchar == ':' && oap->op_type != OP_COLON))
|
|| (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;
|
resel_VIsual_line_count = oap->line_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* can't redo yank (unless 'y' is in 'cpoptions') and ":" */
|
// can't redo yank (unless 'y' is in 'cpoptions') and ":"
|
||||||
if ((vim_strchr(p_cpo, CPO_YANK) != NULL || oap->op_type != OP_YANK)
|
if ((redo_yank || oap->op_type != OP_YANK)
|
||||||
&& oap->op_type != OP_COLON
|
&& oap->op_type != OP_COLON
|
||||||
&& oap->op_type != OP_FOLD
|
&& oap->op_type != OP_FOLD
|
||||||
&& oap->op_type != OP_FOLDOPEN
|
&& oap->op_type != OP_FOLDOPEN
|
||||||
|
Reference in New Issue
Block a user