From cfe456543e840d133399551f8626d985e1fb1958 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 27 May 2022 17:26:55 +0100 Subject: patch 8.2.5029: "textlock" is always zero Problem: "textlock" is always zero. Solution: Remove "textlock" and rename "textwinlock" to "textlock". (closes #10489) --- src/insexpand.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/insexpand.c') diff --git a/src/insexpand.c b/src/insexpand.c index 89e0ebd818..20df1b0f37 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -1144,9 +1144,9 @@ trigger_complete_changed_event(int cur) 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 @@ expand_by_function(int type, char_u *base) // 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 @@ expand_by_function(int type, char_u *base) break; } } - --textwinlock; + --textlock; curwin->w_cursor = pos; // restore the cursor position validate_cursor(); @@ -2867,7 +2867,6 @@ set_completion(colnr_T startcol, list_T *list) 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 @@ f_complete(typval_T *argvars, typval_T *rettv UNUSED) 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 @@ f_complete(typval_T *argvars, typval_T *rettv UNUSED) if (startcol > 0) set_completion(startcol - 1, argvars[1].vval.v_list); } - textlock = save_textlock; } /* @@ -4508,10 +4502,10 @@ get_userdefined_compl_info(colnr_T curs_col UNUSED) 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 -- cgit v1.2.3