mirror of
https://github.com/neovim/neovim.git
synced 2025-09-09 04:48:18 +00:00
fix(lua): fix architecture-dependent behavior in usercmd "reg" (#20384)
I don't think using an integer as a NUL-terminated string can work on big-endian systems, at least. This is also not tested. Add a test. Also fix a mistake in the docs of nvim_parse_cmd.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user