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.end.lnum = eap->line2;
oa.line_count = eap->line2 - eap->line1 + 1; oa.line_count = eap->line2 - eap->line1 + 1;
oa.motion_type = kMTLineWise; oa.motion_type = kMTLineWise;
virtual_op = false; virtual_op = kFalse;
if (eap->cmdidx != CMD_yank) { // position cursor for undo if (eap->cmdidx != CMD_yank) { // position cursor for undo
setpcmark(); setpcmark();
curwin->w_cursor.lnum = eap->line1; curwin->w_cursor.lnum = eap->line1;
@@ -7426,7 +7426,7 @@ static void ex_operators(exarg_T *eap)
op_shift(&oa, FALSE, eap->amount); op_shift(&oa, FALSE, eap->amount);
break; break;
} }
virtual_op = MAYBE; virtual_op = kNone;
ex_may_print(eap); 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 EXTERN char pseps[2] INIT(= { '\\', 0 }); // normal path separator string
#endif #endif
/* Set to TRUE when an operator is being executed with virtual editing, MAYBE // Set to kTrue when an operator is being executed with virtual editing
* when no operator is being executed, FALSE otherwise. */ // kNone when no operator is being executed, kFalse otherwise.
EXTERN int virtual_op INIT(= MAYBE); EXTERN TriState virtual_op INIT(= kNone);
/* Display tick, incremented for each call to update_screen() */ /* Display tick, incremented for each call to update_screen() */
EXTERN disptick_T display_tick INIT(= 0); 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: default:
clearopbeep(oap); clearopbeep(oap);
} }
virtual_op = MAYBE; virtual_op = kNone;
if (!gui_yank) { if (!gui_yank) {
/* /*
* if 'sol' not set, go back to old column for some commands * 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) static void op_function(oparg_T *oap)
{ {
int save_virtual_op = virtual_op; const TriState save_virtual_op = virtual_op;
if (*p_opfunc == NUL) if (*p_opfunc == NUL)
EMSG(_("E774: 'operatorfunc' is empty")); 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 // Reset virtual_op so that 'virtualedit' can be changed in the
// function. // function.
virtual_op = MAYBE; virtual_op = kNone;
(void)call_func_retnr(p_opfunc, 1, argv, false); (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: case Ctrl_V:
virtual_op = virtual_active(); virtual_op = virtual_active();
block_prep(&oparg, &bd, lnum, 0); block_prep(&oparg, &bd, lnum, 0);
virtual_op = MAYBE; virtual_op = kNone;
s = bd.textstart; s = bd.textstart;
len = (long)bd.textlen; len = (long)bd.textlen;
break; break;

View File

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