diff options
author | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
commit | 308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (patch) | |
tree | 35fe43e01755e0f312650667004487a44d6b7941 /src/nvim/generators/gen_ex_cmds.lua | |
parent | 96a00c7c588b2f38a2424aeeb4ea3581d370bf2d (diff) | |
parent | e8c94697bcbe23a5c7b07c292b90a6b70aadfa87 (diff) | |
download | rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.gz rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.bz2 rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.zip |
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'src/nvim/generators/gen_ex_cmds.lua')
-rw-r--r-- | src/nvim/generators/gen_ex_cmds.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/nvim/generators/gen_ex_cmds.lua b/src/nvim/generators/gen_ex_cmds.lua index 844661adc3..255c415a4d 100644 --- a/src/nvim/generators/gen_ex_cmds.lua +++ b/src/nvim/generators/gen_ex_cmds.lua @@ -65,20 +65,31 @@ for _, cmd in ipairs(defs) do assert(cmd.addr_type ~= 'ADDR_OTHER' and cmd.addr_type ~= 'ADDR_NONE', string.format('ex_cmds.lua:%s: Missing misplaced DFLALL\n', cmd.command)) end + if bit.band(cmd.flags, flags.PREVIEW) == flags.PREVIEW then + assert(cmd.preview_func ~= nil, + string.format('ex_cmds.lua:%s: Missing preview_func\n', cmd.command)) + end local enumname = cmd.enum or ('CMD_' .. cmd.command) local byte_cmd = cmd.command:sub(1, 1):byte() if byte_a <= byte_cmd and byte_cmd <= byte_z then table.insert(cmds, cmd.command) end + local preview_func + if cmd.preview_func then + preview_func = string.format("(ex_preview_func_T)&%s", cmd.preview_func) + else + preview_func = "NULL" + end enumfile:write(' ' .. enumname .. ',\n') defsfile:write(string.format([[ [%s] = { - .cmd_name = (char_u *) "%s", + .cmd_name = "%s", .cmd_func = (ex_func_T)&%s, + .cmd_preview_func = %s, .cmd_argt = %uL, .cmd_addr_type = %s }, -]], enumname, cmd.command, cmd.func, cmd.flags, cmd.addr_type)) +]], enumname, cmd.command, cmd.func, preview_func, cmd.flags, cmd.addr_type)) end for i = #cmds, 1, -1 do local cmd = cmds[i] |