1
0
forked from aniani/vim

patch 8.2.5029: "textlock" is always zero

Problem:    "textlock" is always zero.
Solution:   Remove "textlock" and rename "textwinlock" to "textlock".
            (closes #10489)
This commit is contained in:
zeertzjq
2022-05-27 17:26:55 +01:00
committed by Bram Moolenaar
parent 02e8d4e4ff
commit cfe456543e
22 changed files with 51 additions and 76 deletions

View File

@@ -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