diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-09-28 18:27:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-28 18:27:59 +0800 |
commit | 35e2c4a2edd28f72c48c70530c5486365c2502a4 (patch) | |
tree | ec54859fafa670fb1b5b8d2801d1a5e0ee5d2e96 /src/nvim/lua/executor.c | |
parent | eb4844b5ed9bcf8c434a93b9f9def4fe81557f37 (diff) | |
download | rneovim-35e2c4a2edd28f72c48c70530c5486365c2502a4.tar.gz rneovim-35e2c4a2edd28f72c48c70530c5486365c2502a4.tar.bz2 rneovim-35e2c4a2edd28f72c48c70530c5486365c2502a4.zip |
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.
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |