edit: dont_sync_undo is TriState

This commit is contained in:
Jan Edmund Lazo
2018-07-16 03:28:24 -04:00
parent deae2e8434
commit 0e55d88639

View File

@@ -242,7 +242,7 @@ static int ins_need_undo; /* call u_save() before inserting a
static int did_add_space = FALSE; /* auto_format() added an extra space static int did_add_space = FALSE; /* auto_format() added an extra space
under the cursor */ under the cursor */
static int dont_sync_undo = false; // CTRL-G U prevents syncing undo static TriState dont_sync_undo = kFalse; // CTRL-G U prevents syncing undo
// for the next left/right cursor // for the next left/right cursor
static linenr_T o_lnum = 0; static linenr_T o_lnum = 0;
@@ -595,10 +595,10 @@ static int insert_check(VimState *state)
s->lastc = s->c; // remember previous char for CTRL-D s->lastc = s->c; // remember previous char for CTRL-D
// After using CTRL-G U the next cursor key will not break undo. // After using CTRL-G U the next cursor key will not break undo.
if (dont_sync_undo == MAYBE) { if (dont_sync_undo == kNone) {
dont_sync_undo = true; dont_sync_undo = kTrue;
} else { } else {
dont_sync_undo = false; dont_sync_undo = kFalse;
} }
return 1; return 1;
@@ -997,7 +997,7 @@ static int insert_handle_key(InsertState *s)
if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) { if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) {
ins_s_left(); ins_s_left();
} else { } else {
ins_left(dont_sync_undo == false); ins_left(dont_sync_undo == kFalse);
} }
break; break;
@@ -1010,7 +1010,7 @@ static int insert_handle_key(InsertState *s)
if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) { if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) {
ins_s_right(); ins_s_right();
} else { } else {
ins_right(dont_sync_undo == false); ins_right(dont_sync_undo == kFalse);
} }
break; break;
@@ -7174,7 +7174,7 @@ static void ins_ctrl_g(void)
case 'U': case 'U':
// Allow one left/right cursor movement with the next char, // Allow one left/right cursor movement with the next char,
// without breaking undo. // without breaking undo.
dont_sync_undo = MAYBE; dont_sync_undo = kNone;
break; break;
/* Unknown CTRL-G command, reserved for future expansion. */ /* Unknown CTRL-G command, reserved for future expansion. */
@@ -7954,7 +7954,7 @@ static void ins_left(bool end_change)
} else { } else {
vim_beep(BO_CRSR); vim_beep(BO_CRSR);
} }
dont_sync_undo = false; dont_sync_undo = kFalse;
} }
static void ins_home(int c) static void ins_home(int c)
@@ -8039,7 +8039,7 @@ static void ins_right(bool end_change)
} else { } else {
vim_beep(BO_CRSR); vim_beep(BO_CRSR);
} }
dont_sync_undo = false; dont_sync_undo = kFalse;
} }
static void ins_s_right(void) static void ins_s_right(void)