patch 8.2.5029: "textlock" is always zero
Problem: "textlock" is always zero.
Solution: Remove "textlock" and rename "textwinlock" to "textlock".
(closes #10489)
diff --git a/src/insexpand.c b/src/insexpand.c
index 89e0ebd..20df1b0 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -1144,9 +1144,9 @@
dict_set_items_ro(v_event);
recursive = TRUE;
- textwinlock++;
+ textlock++;
apply_autocmds(EVENT_COMPLETECHANGED, NULL, NULL, FALSE, curbuf);
- textwinlock--;
+ textlock--;
recursive = FALSE;
restore_v_event(v_event, &save_v_event);
@@ -2643,7 +2643,7 @@
// Lock the text to avoid weird things from happening. Also disallow
// switching to another window, it should not be needed and may end up in
// Insert mode in another buffer.
- ++textwinlock;
+ ++textlock;
cb = get_insert_callback(type);
retval = call_callback(cb, 0, &rettv, 2, args);
@@ -2669,7 +2669,7 @@
break;
}
}
- --textwinlock;
+ --textlock;
curwin->w_cursor = pos; // restore the cursor position
validate_cursor();
@@ -2867,7 +2867,6 @@
f_complete(typval_T *argvars, typval_T *rettv UNUSED)
{
int startcol;
- int save_textlock = textlock;
if (in_vim9script()
&& (check_for_number_arg(argvars, 0) == FAIL
@@ -2880,10 +2879,6 @@
return;
}
- // "textlock" is set when evaluating 'completefunc' but we can change
- // text here.
- textlock = 0;
-
// Check for undo allowed here, because if something was already inserted
// the line was already saved for undo and this check isn't done.
if (!undo_allowed())
@@ -2897,7 +2892,6 @@
if (startcol > 0)
set_completion(startcol - 1, argvars[1].vval.v_list);
}
- textlock = save_textlock;
}
/*
@@ -4508,10 +4502,10 @@
args[1].vval.v_string = (char_u *)"";
args[2].v_type = VAR_UNKNOWN;
pos = curwin->w_cursor;
- ++textwinlock;
+ ++textlock;
cb = get_insert_callback(ctrl_x_mode);
col = call_callback_retnr(cb, 2, args);
- --textwinlock;
+ --textlock;
State = save_State;
curwin->w_cursor = pos; // restore the cursor position