From 42e44d6d334bda8b97afe9e34a819ab293e5e10a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 7 Nov 2022 10:26:54 +0800 Subject: vim-patch:8.2.3751: cannot assign a lambda to an option that takes a function Problem: Cannot assign a lambda to an option that takes a function. Solution: Automatically convert the lambda to a string. (Yegappan Lakshmanan, closes vim/vim#9286) https://github.com/vim/vim/commit/6409553b6e3b4de4e1d72b8ee5445595214581ff Co-authored-by: Yegappan Lakshmanan --- src/nvim/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/context.c') diff --git a/src/nvim/context.c b/src/nvim/context.c index 34692cdf64..c765b95733 100644 --- a/src/nvim/context.c +++ b/src/nvim/context.c @@ -131,7 +131,7 @@ bool ctx_restore(Context *ctx, const int flags) } char *op_shada; - get_option_value("shada", NULL, &op_shada, OPT_GLOBAL); + get_option_value("shada", NULL, &op_shada, NULL, OPT_GLOBAL); set_option_value("shada", 0L, "!,'100,%", OPT_GLOBAL); if (flags & kCtxRegs) { -- cgit From 66360675cf4d091b7460e4a8e1435c13216c1929 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 11 Sep 2022 17:12:44 +0200 Subject: build: allow IWYU to fix includes for all .c files Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers. --- src/nvim/context.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/nvim/context.c') diff --git a/src/nvim/context.c b/src/nvim/context.c index c765b95733..5ea843e023 100644 --- a/src/nvim/context.c +++ b/src/nvim/context.c @@ -3,16 +3,28 @@ // Context: snapshot of the entire editor state as one big object/map +#include +#include +#include + #include "nvim/api/private/converter.h" #include "nvim/api/private/helpers.h" -#include "nvim/api/vim.h" #include "nvim/api/vimscript.h" #include "nvim/context.h" #include "nvim/eval/encode.h" +#include "nvim/eval/typval.h" +#include "nvim/eval/typval_defs.h" #include "nvim/eval/userfunc.h" #include "nvim/ex_docmd.h" +#include "nvim/gettext.h" +#include "nvim/hashtab.h" +#include "nvim/keycodes.h" +#include "nvim/memory.h" +#include "nvim/message.h" #include "nvim/option.h" #include "nvim/shada.h" +#include "nvim/types.h" +#include "nvim/vim.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "context.c.generated.h" -- cgit From bd22585061b66d7f71d4832b4a81e950b3c9d19d Mon Sep 17 00:00:00 2001 From: Dundar Göc Date: Fri, 26 Aug 2022 23:11:25 +0200 Subject: refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- src/nvim/context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/context.c') diff --git a/src/nvim/context.c b/src/nvim/context.c index 5ea843e023..47e60373bf 100644 --- a/src/nvim/context.c +++ b/src/nvim/context.c @@ -263,12 +263,12 @@ static inline void ctx_save_funcs(Context *ctx, bool scriptonly) Error err = ERROR_INIT; HASHTAB_ITER(func_tbl_get(), hi, { - const char_u *const name = hi->hi_key; + const char *const name = hi->hi_key; bool islambda = (STRNCMP(name, "", 8) == 0); - bool isscript = (name[0] == K_SPECIAL); + bool isscript = ((uint8_t)name[0] == K_SPECIAL); if (!islambda && (!scriptonly || isscript)) { - size_t cmd_len = sizeof("func! ") + STRLEN(name); + size_t cmd_len = sizeof("func! ") + strlen(name); char *cmd = xmalloc(cmd_len); snprintf(cmd, cmd_len, "func! %s", name); String func_body = nvim_exec(VIML_INTERNAL_CALL, cstr_as_string(cmd), -- cgit From 3b96ccf7d35be90e49029dec76344d3d92ad91dc Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 26 Nov 2022 18:57:46 +0100 Subject: refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459 --- src/nvim/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/context.c') diff --git a/src/nvim/context.c b/src/nvim/context.c index 47e60373bf..b064a92b74 100644 --- a/src/nvim/context.c +++ b/src/nvim/context.c @@ -264,7 +264,7 @@ static inline void ctx_save_funcs(Context *ctx, bool scriptonly) HASHTAB_ITER(func_tbl_get(), hi, { const char *const name = hi->hi_key; - bool islambda = (STRNCMP(name, "", 8) == 0); + bool islambda = (strncmp(name, "", 8) == 0); bool isscript = ((uint8_t)name[0] == K_SPECIAL); if (!islambda && (!scriptonly || isscript)) { -- cgit