diff src/insexpand.c @ 29014:45c182c4f7e9 v8.2.5029

patch 8.2.5029: "textlock" is always zero Commit: https://github.com/vim/vim/commit/cfe456543e840d133399551f8626d985e1fb1958 Author: zeertzjq <zeertzjq@outlook.com> Date: Fri May 27 17:26:55 2022 +0100 patch 8.2.5029: "textlock" is always zero Problem: "textlock" is always zero. Solution: Remove "textlock" and rename "textwinlock" to "textlock". (closes #10489)
author Bram Moolenaar <Bram@vim.org>
date Fri, 27 May 2022 18:30:04 +0200
parents 7d28903e80df
children 755ab148288b
line wrap: on
line diff
--- 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 *bas
     // 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 *bas
 		break;
 	}
     }
-    --textwinlock;
+    --textlock;
 
     curwin->w_cursor = pos;	// restore the cursor position
     validate_cursor();
@@ -2867,7 +2867,6 @@ set_completion(colnr_T startcol, list_T 
 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 *
 	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 *
 	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_
     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