diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/command.c | 6 | ||||
-rw-r--r-- | src/nvim/lua/executor.c | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c index ed0907e8f8..699c62c15c 100644 --- a/src/nvim/api/command.c +++ b/src/nvim/api/command.c @@ -37,7 +37,7 @@ /// specified and two elements if both range items were specified. /// - count: (number) Any |<count>| that was supplied to the command. -1 if command cannot /// take a count. -/// - reg: (number) The optional command |<register>|, if specified. Empty string if not +/// - reg: (string) The optional command |<register>|, if specified. Empty string if not /// specified or if command cannot take a register. /// - bang: (boolean) Whether command contains a |<bang>| (!) modifier. /// - args: (array) Command arguments. @@ -165,9 +165,7 @@ Dictionary nvim_parse_cmd(String str, Dictionary opts, Error *err) PUT(result, "count", INTEGER_OBJ(-1)); } - char reg[2]; - reg[0] = (char)ea.regname; - reg[1] = '\0'; + char reg[2] = { (char)ea.regname, NUL }; PUT(result, "reg", CSTR_TO_OBJ(reg)); PUT(result, "bang", BOOLEAN_OBJ(ea.forceit)); diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 6063414a02..f3821f149a 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -2036,7 +2036,8 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview) } lua_setfield(lstate, -2, "fargs"); - lua_pushstring(lstate, (const char *)&eap->regname); + char reg[2] = { (char)eap->regname, NUL }; + lua_pushstring(lstate, reg); lua_setfield(lstate, -2, "reg"); lua_pushinteger(lstate, eap->addr_count); |