diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
commit | 1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch) | |
tree | cd08258054db80bb9a11b1061bb091c70b76926a /src/nvim/lua/spell.c | |
parent | eaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-1b7b916b7631ddf73c38e3a0070d64e4636cb2f3.tar.gz rneovim-1b7b916b7631ddf73c38e3a0070d64e4636cb2f3.tar.bz2 rneovim-1b7b916b7631ddf73c38e3a0070d64e4636cb2f3.zip |
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'src/nvim/lua/spell.c')
-rw-r--r-- | src/nvim/lua/spell.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c index d510d25e90..c261c5105e 100644 --- a/src/nvim/lua/spell.c +++ b/src/nvim/lua/spell.c @@ -1,6 +1,3 @@ -// This is an open source non-commercial project. Dear PVS-Studio, please check -// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com - #include <assert.h> #include <lauxlib.h> #include <limits.h> @@ -8,7 +5,7 @@ #include <stdbool.h> #include <stddef.h> -#include "nvim/ascii.h" +#include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" #include "nvim/gettext.h" #include "nvim/globals.h" @@ -16,7 +13,6 @@ #include "nvim/lua/spell.h" #include "nvim/message.h" #include "nvim/spell.h" -#include "nvim/types.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "lua/spell.c.generated.h" // IWYU pragma: export @@ -39,7 +35,7 @@ int nlua_spell_check(lua_State *lstate) const int wo_spell_save = curwin->w_p_spell; if (!curwin->w_p_spell) { - did_set_spelllang(curwin); + parse_spelllang(curwin); curwin->w_p_spell = true; } @@ -51,7 +47,6 @@ int nlua_spell_check(lua_State *lstate) } hlf_T attr = HLF_COUNT; - size_t len = 0; size_t pos = 0; int capcol = -1; int no_res = 0; @@ -61,7 +56,7 @@ int nlua_spell_check(lua_State *lstate) while (*str != NUL) { attr = HLF_COUNT; - len = spell_check(curwin, (char *)str, &attr, &capcol, false); + size_t len = spell_check(curwin, (char *)str, &attr, &capcol, false); assert(len <= INT_MAX); if (attr != HLF_COUNT) { @@ -70,11 +65,11 @@ int nlua_spell_check(lua_State *lstate) lua_pushlstring(lstate, str, len); lua_rawseti(lstate, -2, 1); - result = attr == HLF_SPB ? "bad" : - attr == HLF_SPR ? "rare" : - attr == HLF_SPL ? "local" : - attr == HLF_SPC ? "caps" : - NULL; + result = attr == HLF_SPB + ? "bad" : (attr == HLF_SPR + ? "rare" : (attr == HLF_SPL + ? "local" : (attr == HLF_SPC + ? "caps" : NULL))); assert(result != NULL); @@ -82,7 +77,7 @@ int nlua_spell_check(lua_State *lstate) lua_rawseti(lstate, -2, 2); // +1 for 1-indexing - lua_pushinteger(lstate, (long)pos + 1); + lua_pushinteger(lstate, (lua_Integer)pos + 1); lua_rawseti(lstate, -2, 3); lua_rawseti(lstate, -2, ++no_res); |