File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ local C = ffi.C
4
4
5
5
local M = setmetatable ({}, { __index = ffi })
6
6
7
+ local HAS_NVIM_0_9 = vim .fn .has (" nvim-0.9" ) == 1
8
+
7
9
--- Check if the |textlock| is active.
8
10
--- @return boolean
9
11
function M .nvim_is_textlocked ()
15
17
--- @return boolean
16
18
function M .nvim_is_locked ()
17
19
if vim .in_fast_event () then return true end
18
- return C .textlock > 0 or C .allbuf_lock > 0 or C .expr_map_lock > 0
20
+
21
+ if HAS_NVIM_0_9 then
22
+ return C .textlock > 0 or C .allbuf_lock > 0 or C .expr_map_lock > 0
23
+ end
24
+
25
+ return C .textlock > 0 or C .allbuf_lock > 0 or C .ex_normal_lock > 0
19
26
end
20
27
21
28
ffi .cdef ([[
@@ -26,9 +33,18 @@ ffi.cdef([[
26
33
/// Non-zero when no buffer name can be changed, no buffer can be deleted and
27
34
/// current directory can't be changed. Used for SwapExists et al.
28
35
extern int allbuf_lock;
29
-
30
- /// Running expr mapping, prevent use of ex_normal() and text changes
31
- extern int expr_map_lock;
32
36
]] )
33
37
38
+ if HAS_NVIM_0_9 then
39
+ ffi .cdef ([[
40
+ /// Running expr mapping, prevent use of ex_normal() and text changes
41
+ extern int expr_map_lock;
42
+ ]] )
43
+ else
44
+ ffi .cdef ([[
45
+ /// prevent use of ex_normal()
46
+ extern int ex_normal_lock;
47
+ ]] )
48
+ end
49
+
34
50
return M
You can’t perform that action at this time.
0 commit comments