globals: virtual_op is TriState

This commit is contained in:
Jan Edmund Lazo 2018-07-18 12:54:58 -04:00
parent faa9869a9e
commit 44cb491f6e
5 changed files with 12 additions and 12 deletions

View File

@ -7395,7 +7395,7 @@ static void ex_operators(exarg_T *eap)
oa.end.lnum = eap->line2;
oa.line_count = eap->line2 - eap->line1 + 1;
oa.motion_type = kMTLineWise;
virtual_op = false;
virtual_op = kFalse;
if (eap->cmdidx != CMD_yank) { // position cursor for undo
setpcmark();
curwin->w_cursor.lnum = eap->line1;
@ -7426,7 +7426,7 @@ static void ex_operators(exarg_T *eap)
op_shift(&oa, FALSE, eap->amount);
break;
}
virtual_op = MAYBE;
virtual_op = kNone;
ex_may_print(eap);
}

View File

@ -952,9 +952,9 @@ EXTERN char psepcN INIT(= '/'); // abnormal path separator character
EXTERN char pseps[2] INIT(= { '\\', 0 }); // normal path separator string
#endif
/* Set to TRUE when an operator is being executed with virtual editing, MAYBE
* when no operator is being executed, FALSE otherwise. */
EXTERN int virtual_op INIT(= MAYBE);
// Set to kTrue when an operator is being executed with virtual editing
// kNone when no operator is being executed, kFalse otherwise.
EXTERN TriState virtual_op INIT(= kNone);
/* Display tick, incremented for each call to update_screen() */
EXTERN disptick_T display_tick INIT(= 0);

View File

@ -2015,7 +2015,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
default:
clearopbeep(oap);
}
virtual_op = MAYBE;
virtual_op = kNone;
if (!gui_yank) {
/*
* if 'sol' not set, go back to old column for some commands
@ -2090,7 +2090,7 @@ static void op_colon(oparg_T *oap)
*/
static void op_function(oparg_T *oap)
{
int save_virtual_op = virtual_op;
const TriState save_virtual_op = virtual_op;
if (*p_opfunc == NUL)
EMSG(_("E774: 'operatorfunc' is empty"));
@ -2113,7 +2113,7 @@ static void op_function(oparg_T *oap)
// Reset virtual_op so that 'virtualedit' can be changed in the
// function.
virtual_op = MAYBE;
virtual_op = kNone;
(void)call_func_retnr(p_opfunc, 1, argv, false);

View File

@ -5383,7 +5383,7 @@ void cursor_pos_info(dict_T *dict)
case Ctrl_V:
virtual_op = virtual_active();
block_prep(&oparg, &bd, lnum, 0);
virtual_op = MAYBE;
virtual_op = kNone;
s = bd.textstart;
len = (long)bd.textlen;
break;

View File

@ -73,13 +73,13 @@ getkey:
}
}
/// Return TRUE if in the current mode we need to use virtual.
int virtual_active(void)
/// Return true if in the current mode we need to use virtual.
bool virtual_active(void)
{
// While an operator is being executed we return "virtual_op", because
// VIsual_active has already been reset, thus we can't check for "block"
// being used.
if (virtual_op != MAYBE) {
if (virtual_op != kNone) {
return virtual_op;
}
return ve_flags == VE_ALL