From c0fe6c040e19ef9102a8507ffcbd88b83186326a Mon Sep 17 00:00:00 2001 From: Null Chilly <56817415+nullchilly@users.noreply.github.com> Date: Thu, 23 Mar 2023 16:31:39 +0700 Subject: feat(api): add nvim_get_hl (#22693) Problem: no way of getting all highlight group definitions in a namespace. Solution: add `nvim_get_hl()`, deprecate `nvim_get_hl_by_name()` and `nvim_get_hl_by_id()`. --- src/nvim/api/deprecated.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 332e2b5fc3..b1e2e6811e 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -10,11 +10,14 @@ #include "nvim/api/extmark.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" +#include "nvim/api/private/validate.h" #include "nvim/api/vimscript.h" #include "nvim/buffer_defs.h" #include "nvim/decoration.h" #include "nvim/extmark.h" #include "nvim/globals.h" +#include "nvim/highlight.h" +#include "nvim/highlight_group.h" #include "nvim/lua/executor.h" #include "nvim/memory.h" #include "nvim/pos.h" @@ -159,6 +162,49 @@ Integer nvim_buf_set_virtual_text(Buffer buffer, Integer src_id, Integer line, A return src_id; } +/// Gets a highlight definition by id. |hlID()| +/// +/// @deprecated use |nvim_get_hl()| instead +/// +/// @param hl_id Highlight id as returned by |hlID()| +/// @param rgb Export RGB colors +/// @param[out] err Error details, if any +/// @return Highlight definition map +/// @see nvim_get_hl_by_name +Dictionary nvim_get_hl_by_id(Integer hl_id, Boolean rgb, Arena *arena, Error *err) + FUNC_API_SINCE(3) + FUNC_API_DEPRECATED_SINCE(9) +{ + Dictionary dic = ARRAY_DICT_INIT; + VALIDATE_INT((syn_get_final_id((int)hl_id) != 0), "highlight id", hl_id, { + return dic; + }); + int attrcode = syn_id2attr((int)hl_id); + return hl_get_attr_by_id(attrcode, rgb, arena, err); +} + +/// Gets a highlight definition by name. +/// +/// @deprecated use |nvim_get_hl()| instead +/// +/// @param name Highlight group name +/// @param rgb Export RGB colors +/// @param[out] err Error details, if any +/// @return Highlight definition map +/// @see nvim_get_hl_by_id +Dictionary nvim_get_hl_by_name(String name, Boolean rgb, Arena *arena, Error *err) + FUNC_API_SINCE(3) + FUNC_API_DEPRECATED_SINCE(9) +{ + Dictionary result = ARRAY_DICT_INIT; + int id = syn_name2id(name.data); + + VALIDATE_S((id != 0), "highlight name", name.data, { + return result; + }); + return nvim_get_hl_by_id(id, rgb, arena, err); +} + /// Inserts a sequence of lines to a buffer at a certain index /// /// @deprecated use nvim_buf_set_lines(buffer, lnum, lnum, true, lines) -- cgit From fe9cbcb3a5c82932ecfb8f49d07e98a1fc2b31e5 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Sat, 25 Mar 2023 18:58:48 +0200 Subject: feat(api): nvim_exec2(), deprecate nvim_exec() #19032 Problem: The signature of nvim_exec() is not extensible per ":help api-contract". Solution: Introduce nvim_exec2() and deprecate nvim_exec(). --- src/nvim/api/deprecated.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index b1e2e6811e..6a12cfe2da 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -27,13 +27,26 @@ # include "api/deprecated.c.generated.h" #endif +/// @deprecated Use nvim_exec2() instead. +/// @see nvim_exec2 +String nvim_exec(uint64_t channel_id, String src, Boolean output, Error *err) + FUNC_API_SINCE(7) + FUNC_API_DEPRECATED_SINCE(11) +{ + Dict(exec_opts) opts = { 0 }; + opts.output = BOOLEAN_OBJ(output); + return exec_impl(channel_id, src, &opts, err); +} + /// @deprecated -/// @see nvim_exec +/// @see nvim_exec2 String nvim_command_output(uint64_t channel_id, String command, Error *err) FUNC_API_SINCE(1) FUNC_API_DEPRECATED_SINCE(7) { - return nvim_exec(channel_id, command, true, err); + Dict(exec_opts) opts = { 0 }; + opts.output = BOOLEAN_OBJ(true); + return exec_impl(channel_id, command, &opts, err); } /// @deprecated Use nvim_exec_lua() instead. -- cgit From b7748662ed5b06c12a74560690b728fdf770666f Mon Sep 17 00:00:00 2001 From: Michal Liszcz Date: Wed, 29 Mar 2023 09:59:01 +0200 Subject: fix(api): Use local LastSet structure in nvim_get_option_info (#22741) fix(api): use local LastSet structure in nvim_get_option_info * nvim_get_option_info is deprecated. It is always using the global LastSet information as reported in #15232. * nvim_get_option_info2 is added. The new function additionally accepts an 'opts' table {scope, buf, win} allowing to specify the option scope and query local options from another buffer or window. --- src/nvim/api/deprecated.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 6a12cfe2da..5937b2f635 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -20,6 +20,7 @@ #include "nvim/highlight_group.h" #include "nvim/lua/executor.h" #include "nvim/memory.h" +#include "nvim/option.h" #include "nvim/pos.h" #include "nvim/types.h" @@ -508,3 +509,16 @@ static int64_t convert_index(int64_t index) { return index < 0 ? index - 1 : index; } + +/// Gets the option information for one option +/// +/// @deprecated Use @ref nvim_get_option_info2 instead. +/// +/// @param name Option name +/// @param[out] err Error details, if any +/// @return Option Information +Dictionary nvim_get_option_info(String name, Error *err) + FUNC_API_SINCE(7) +{ + return get_vimoption(name, OPT_GLOBAL, curbuf, curwin, err); +} -- cgit From eb4676c67f5dd54bcda473783315901a3444b40b Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 27 Apr 2023 17:30:22 +0100 Subject: fix: disallow removing extmarks in on_lines callbacks (#23219) fix(extmarks): disallow removing extmarks in on_lines callbacks decor_redraw_start (which runs before decor_providers_invoke_lines) gets references for the extmarks on a specific line. If these extmarks are deleted in on_lines callbacks then this results in a heap-use-after-free error. Fixes #22801 --- src/nvim/api/deprecated.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 5937b2f635..0ca505e7b2 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -172,7 +172,7 @@ Integer nvim_buf_set_virtual_text(Buffer buffer, Integer src_id, Integer line, A decor.priority = 0; extmark_set(buf, ns_id, NULL, (int)line, 0, -1, -1, &decor, true, - false, kExtmarkNoUndo); + false, kExtmarkNoUndo, NULL); return src_id; } -- cgit From 1fe1bb084d0099fc4f9bfdc11189485d0f74b75a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 19 Dec 2022 16:37:45 +0000 Subject: refactor(options): deprecate nvim[_buf|_win]_[gs]et_option Co-authored-by: zeertzjq Co-authored-by: famiu --- src/nvim/api/deprecated.c | 220 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 0ca505e7b2..a7e5b32d49 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -8,6 +8,7 @@ #include "nvim/api/buffer.h" #include "nvim/api/deprecated.h" #include "nvim/api/extmark.h" +#include "nvim/api/options.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/api/private/validate.h" @@ -522,3 +523,222 @@ Dictionary nvim_get_option_info(String name, Error *err) { return get_vimoption(name, OPT_GLOBAL, curbuf, curwin, err); } + +/// Sets the global value of an option. +/// +/// @deprecated +/// @param channel_id +/// @param name Option name +/// @param value New option value +/// @param[out] err Error details, if any +void nvim_set_option(uint64_t channel_id, String name, Object value, Error *err) + FUNC_API_SINCE(1) +{ + set_option_to(channel_id, NULL, SREQ_GLOBAL, name, value, err); +} + +/// Gets the global value of an option. +/// +/// @deprecated +/// @param name Option name +/// @param[out] err Error details, if any +/// @return Option value (global) +Object nvim_get_option(String name, Arena *arena, Error *err) + FUNC_API_SINCE(1) +{ + return get_option_from(NULL, SREQ_GLOBAL, name, err); +} + +/// Gets a buffer option value +/// +/// @deprecated +/// @param buffer Buffer handle, or 0 for current buffer +/// @param name Option name +/// @param[out] err Error details, if any +/// @return Option value +Object nvim_buf_get_option(Buffer buffer, String name, Arena *arena, Error *err) + FUNC_API_SINCE(1) +{ + buf_T *buf = find_buffer_by_handle(buffer, err); + + if (!buf) { + return (Object)OBJECT_INIT; + } + + return get_option_from(buf, SREQ_BUF, name, err); +} + +/// Sets a buffer option value. Passing `nil` as value deletes the option (only +/// works if there's a global fallback) +/// +/// @deprecated +/// @param channel_id +/// @param buffer Buffer handle, or 0 for current buffer +/// @param name Option name +/// @param value Option value +/// @param[out] err Error details, if any +void nvim_buf_set_option(uint64_t channel_id, Buffer buffer, String name, Object value, Error *err) + FUNC_API_SINCE(1) +{ + buf_T *buf = find_buffer_by_handle(buffer, err); + + if (!buf) { + return; + } + + set_option_to(channel_id, buf, SREQ_BUF, name, value, err); +} + +/// Gets a window option value +/// +/// @deprecated +/// @param window Window handle, or 0 for current window +/// @param name Option name +/// @param[out] err Error details, if any +/// @return Option value +Object nvim_win_get_option(Window window, String name, Arena *arena, Error *err) + FUNC_API_SINCE(1) +{ + win_T *win = find_window_by_handle(window, err); + + if (!win) { + return (Object)OBJECT_INIT; + } + + return get_option_from(win, SREQ_WIN, name, err); +} + +/// Sets a window option value. Passing `nil` as value deletes the option (only +/// works if there's a global fallback) +/// +/// @deprecated +/// @param channel_id +/// @param window Window handle, or 0 for current window +/// @param name Option name +/// @param value Option value +/// @param[out] err Error details, if any +void nvim_win_set_option(uint64_t channel_id, Window window, String name, Object value, Error *err) + FUNC_API_SINCE(1) +{ + win_T *win = find_window_by_handle(window, err); + + if (!win) { + return; + } + + set_option_to(channel_id, win, SREQ_WIN, name, value, err); +} + +/// Gets the value of a global or local (buffer, window) option. +/// +/// @param from If `type` is `SREQ_WIN` or `SREQ_BUF`, this must be a pointer +/// to the window or buffer. +/// @param type One of `SREQ_GLOBAL`, `SREQ_WIN` or `SREQ_BUF` +/// @param name The option name +/// @param[out] err Details of an error that may have occurred +/// @return the option value +static Object get_option_from(void *from, int type, String name, Error *err) +{ + Object rv = OBJECT_INIT; + + VALIDATE_S(name.size > 0, "option name", "", { + return rv; + }); + + // Return values + int64_t numval; + char *stringval = NULL; + + int flags = get_option_value_strict(name.data, &numval, &stringval, type, from); + VALIDATE_S(flags != 0, "option name", name.data, { + return rv; + }); + + if (flags & SOPT_BOOL) { + rv.type = kObjectTypeBoolean; + rv.data.boolean = numval ? true : false; + } else if (flags & SOPT_NUM) { + rv.type = kObjectTypeInteger; + rv.data.integer = numval; + } else if (flags & SOPT_STRING) { + if (!stringval) { + api_set_error(err, kErrorTypeException, "Failed to get option '%s'", name.data); + return rv; + } + rv.type = kObjectTypeString; + rv.data.string.data = stringval; + rv.data.string.size = strlen(stringval); + } else { + api_set_error(err, kErrorTypeException, "Unknown type for option '%s'", name.data); + } + + return rv; +} + +/// Sets the value of a global or local (buffer, window) option. +/// +/// @param to If `type` is `SREQ_WIN` or `SREQ_BUF`, this must be a pointer +/// to the window or buffer. +/// @param type One of `SREQ_GLOBAL`, `SREQ_WIN` or `SREQ_BUF` +/// @param name The option name +/// @param[out] err Details of an error that may have occurred +static void set_option_to(uint64_t channel_id, void *to, int type, String name, Object value, + Error *err) +{ + VALIDATE_S(name.size > 0, "option name", "", { + return; + }); + + int flags = get_option_value_strict(name.data, NULL, NULL, type, to); + VALIDATE_S(flags != 0, "option name", name.data, { + return; + }); + + if (value.type == kObjectTypeNil) { + if (type == SREQ_GLOBAL) { + api_set_error(err, kErrorTypeException, "Cannot unset option '%s'", name.data); + return; + } else if (!(flags & SOPT_GLOBAL)) { + api_set_error(err, kErrorTypeException, + "Cannot unset option '%s' because it doesn't have a global value", + name.data); + return; + } else { + unset_global_local_option(name.data, to); + return; + } + } + + long numval = 0; + char *stringval = NULL; + + if (flags & SOPT_BOOL) { + VALIDATE(value.type == kObjectTypeBoolean, "Option '%s' value must be Boolean", name.data, { + return; + }); + numval = value.data.boolean; + } else if (flags & SOPT_NUM) { + VALIDATE(value.type == kObjectTypeInteger, "Option '%s' value must be Integer", name.data, { + return; + }); + VALIDATE((value.data.integer <= INT_MAX && value.data.integer >= INT_MIN), + "Option '%s' value is out of range", name.data, { + return; + }); + numval = (int)value.data.integer; + } else { + VALIDATE(value.type == kObjectTypeString, "Option '%s' value must be String", name.data, { + return; + }); + stringval = value.data.string.data; + } + + // For global-win-local options -> setlocal + // For win-local options -> setglobal and setlocal (opt_flags == 0) + const int opt_flags = (type == SREQ_WIN && !(flags & SOPT_GLOBAL)) ? 0 : + (type == SREQ_GLOBAL) ? OPT_GLOBAL : OPT_LOCAL; + + WITH_SCRIPT_CONTEXT(channel_id, { + access_option_value_for(name.data, &numval, &stringval, opt_flags, type, to, false, err); + }); +} -- cgit From b3d5138fd0066fda26ef7724a542ae45eb42fc84 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Wed, 7 Jun 2023 06:05:16 +0600 Subject: refactor(options): remove `getoption_T` and introduce `OptVal` (#23850) Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options. --- src/nvim/api/deprecated.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index a7e5b32d49..83c33db5d3 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -709,14 +709,13 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name, } } - long numval = 0; - char *stringval = NULL; + OptVal optval = NIL_OPTVAL; if (flags & SOPT_BOOL) { VALIDATE(value.type == kObjectTypeBoolean, "Option '%s' value must be Boolean", name.data, { return; }); - numval = value.data.boolean; + optval = BOOLEAN_OPTVAL(value.data.boolean); } else if (flags & SOPT_NUM) { VALIDATE(value.type == kObjectTypeInteger, "Option '%s' value must be Integer", name.data, { return; @@ -725,12 +724,12 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name, "Option '%s' value is out of range", name.data, { return; }); - numval = (int)value.data.integer; + optval = NUMBER_OPTVAL(value.data.integer); } else { VALIDATE(value.type == kObjectTypeString, "Option '%s' value must be String", name.data, { return; }); - stringval = value.data.string.data; + optval = STRING_OPTVAL(value.data.string); } // For global-win-local options -> setlocal @@ -739,6 +738,6 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name, (type == SREQ_GLOBAL) ? OPT_GLOBAL : OPT_LOCAL; WITH_SCRIPT_CONTEXT(channel_id, { - access_option_value_for(name.data, &numval, &stringval, opt_flags, type, to, false, err); + set_option_value_for(name.data, optval, opt_flags, type, to, err); }); } -- cgit From 2493815290c4cb5b1fb97b6d010c10bdf2d47a58 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 30 Jun 2023 21:13:08 +0800 Subject: refactor: fix clang/PVS warnings (#24213) --- src/nvim/api/deprecated.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 83c33db5d3..2e3ebd7c39 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -709,7 +709,7 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name, } } - OptVal optval = NIL_OPTVAL; + OptVal optval; if (flags & SOPT_BOOL) { VALIDATE(value.type == kObjectTypeBoolean, "Option '%s' value must be Boolean", name.data, { -- cgit From 7bc93e0e2f246dd78026a3472d929a0fe450f70d Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 1 Aug 2023 14:01:19 +0200 Subject: refactor(api): use typed keysets Initially this is just for geting rid of boilerplate, but eventually the types could get exposed as metadata --- src/nvim/api/deprecated.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 2e3ebd7c39..f5a77ece7e 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -35,8 +35,7 @@ String nvim_exec(uint64_t channel_id, String src, Boolean output, Error *err) FUNC_API_SINCE(7) FUNC_API_DEPRECATED_SINCE(11) { - Dict(exec_opts) opts = { 0 }; - opts.output = BOOLEAN_OBJ(output); + Dict(exec_opts) opts = { .output = output }; return exec_impl(channel_id, src, &opts, err); } @@ -46,8 +45,7 @@ String nvim_command_output(uint64_t channel_id, String command, Error *err) FUNC_API_SINCE(1) FUNC_API_DEPRECATED_SINCE(7) { - Dict(exec_opts) opts = { 0 }; - opts.output = BOOLEAN_OBJ(true); + Dict(exec_opts) opts = { .output = true }; return exec_impl(channel_id, command, &opts, err); } -- cgit From db51548036ebe4b01c5b78aeca7a76aa71ab4fbe Mon Sep 17 00:00:00 2001 From: Maria José Solano Date: Sun, 24 Sep 2023 21:39:59 -0700 Subject: docs: do not use deprecated functions #25334 --- src/nvim/api/deprecated.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index f5a77ece7e..f345edc52c 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -518,6 +518,7 @@ static int64_t convert_index(int64_t index) /// @return Option Information Dictionary nvim_get_option_info(String name, Error *err) FUNC_API_SINCE(7) + FUNC_API_DEPRECATED_SINCE(11) { return get_vimoption(name, OPT_GLOBAL, curbuf, curwin, err); } @@ -531,6 +532,7 @@ Dictionary nvim_get_option_info(String name, Error *err) /// @param[out] err Error details, if any void nvim_set_option(uint64_t channel_id, String name, Object value, Error *err) FUNC_API_SINCE(1) + FUNC_API_DEPRECATED_SINCE(11) { set_option_to(channel_id, NULL, SREQ_GLOBAL, name, value, err); } @@ -543,6 +545,7 @@ void nvim_set_option(uint64_t channel_id, String name, Object value, Error *err) /// @return Option value (global) Object nvim_get_option(String name, Arena *arena, Error *err) FUNC_API_SINCE(1) + FUNC_API_DEPRECATED_SINCE(11) { return get_option_from(NULL, SREQ_GLOBAL, name, err); } @@ -556,6 +559,7 @@ Object nvim_get_option(String name, Arena *arena, Error *err) /// @return Option value Object nvim_buf_get_option(Buffer buffer, String name, Arena *arena, Error *err) FUNC_API_SINCE(1) + FUNC_API_DEPRECATED_SINCE(11) { buf_T *buf = find_buffer_by_handle(buffer, err); @@ -577,6 +581,7 @@ Object nvim_buf_get_option(Buffer buffer, String name, Arena *arena, Error *err) /// @param[out] err Error details, if any void nvim_buf_set_option(uint64_t channel_id, Buffer buffer, String name, Object value, Error *err) FUNC_API_SINCE(1) + FUNC_API_DEPRECATED_SINCE(11) { buf_T *buf = find_buffer_by_handle(buffer, err); @@ -596,6 +601,7 @@ void nvim_buf_set_option(uint64_t channel_id, Buffer buffer, String name, Object /// @return Option value Object nvim_win_get_option(Window window, String name, Arena *arena, Error *err) FUNC_API_SINCE(1) + FUNC_API_DEPRECATED_SINCE(11) { win_T *win = find_window_by_handle(window, err); @@ -617,6 +623,7 @@ Object nvim_win_get_option(Window window, String name, Arena *arena, Error *err) /// @param[out] err Error details, if any void nvim_win_set_option(uint64_t channel_id, Window window, String name, Object value, Error *err) FUNC_API_SINCE(1) + FUNC_API_DEPRECATED_SINCE(11) { win_T *win = find_window_by_handle(window, err); -- cgit From af7d317f3ff31d5ac5d8724b5057a422e1451b54 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 26 Sep 2023 22:36:08 +0200 Subject: refactor: remove long long is 32-bits even on 64-bit windows which makes the type suboptimal for a codebase meant to be cross-platform. --- src/nvim/api/deprecated.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index f345edc52c..a96485be83 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -729,7 +729,7 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name, "Option '%s' value is out of range", name.data, { return; }); - optval = NUMBER_OPTVAL(value.data.integer); + optval = NUMBER_OPTVAL((OptInt)value.data.integer); } else { VALIDATE(value.type == kObjectTypeString, "Option '%s' value must be String", name.data, { return; -- cgit From cf8b2c0e74fd5e723b0c15c2ce84e6900fd322d3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 12:05:28 +0800 Subject: build(iwyu): add a few more _defs.h mappings (#25435) --- src/nvim/api/deprecated.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index a96485be83..e0827012f6 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -1,13 +1,15 @@ // 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 #include #include -#include +#include #include "nvim/api/buffer.h" #include "nvim/api/deprecated.h" #include "nvim/api/extmark.h" +#include "nvim/api/keysets.h" #include "nvim/api/options.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" -- cgit From 6c87d3e0fbf88ae693be11a3ede3a1ec6ec0e30e Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Thu, 19 Oct 2023 20:09:02 +0600 Subject: refactor(options): `get_option_value_strict()` and `SREQ_*` `SREQ_*` values are now actual typedef'd enums. `get_option_value_strict()` has also been refactored and split into two functions, `get_option_attrs()` for getting the option attributes, and `get_option_value_strict()` for getting the actual value. Moreover, it now returns an `OptVal`. Other miscellaneous refactors have also been made. --- src/nvim/api/deprecated.c | 116 +++++++++++++++++----------------------------- 1 file changed, 42 insertions(+), 74 deletions(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index e0827012f6..31ba20f627 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -536,7 +536,7 @@ void nvim_set_option(uint64_t channel_id, String name, Object value, Error *err) FUNC_API_SINCE(1) FUNC_API_DEPRECATED_SINCE(11) { - set_option_to(channel_id, NULL, SREQ_GLOBAL, name, value, err); + set_option_to(channel_id, NULL, kOptReqGlobal, name, value, err); } /// Gets the global value of an option. @@ -549,7 +549,7 @@ Object nvim_get_option(String name, Arena *arena, Error *err) FUNC_API_SINCE(1) FUNC_API_DEPRECATED_SINCE(11) { - return get_option_from(NULL, SREQ_GLOBAL, name, err); + return get_option_from(NULL, kOptReqGlobal, name, err); } /// Gets a buffer option value @@ -569,7 +569,7 @@ Object nvim_buf_get_option(Buffer buffer, String name, Arena *arena, Error *err) return (Object)OBJECT_INIT; } - return get_option_from(buf, SREQ_BUF, name, err); + return get_option_from(buf, kOptReqBuf, name, err); } /// Sets a buffer option value. Passing `nil` as value deletes the option (only @@ -591,7 +591,7 @@ void nvim_buf_set_option(uint64_t channel_id, Buffer buffer, String name, Object return; } - set_option_to(channel_id, buf, SREQ_BUF, name, value, err); + set_option_to(channel_id, buf, kOptReqBuf, name, value, err); } /// Gets a window option value @@ -611,7 +611,7 @@ Object nvim_win_get_option(Window window, String name, Arena *arena, Error *err) return (Object)OBJECT_INIT; } - return get_option_from(win, SREQ_WIN, name, err); + return get_option_from(win, kOptReqWin, name, err); } /// Sets a window option value. Passing `nil` as value deletes the option (only @@ -633,76 +633,56 @@ void nvim_win_set_option(uint64_t channel_id, Window window, String name, Object return; } - set_option_to(channel_id, win, SREQ_WIN, name, value, err); + set_option_to(channel_id, win, kOptReqWin, name, value, err); } /// Gets the value of a global or local (buffer, window) option. /// -/// @param from If `type` is `SREQ_WIN` or `SREQ_BUF`, this must be a pointer -/// to the window or buffer. -/// @param type One of `SREQ_GLOBAL`, `SREQ_WIN` or `SREQ_BUF` -/// @param name The option name -/// @param[out] err Details of an error that may have occurred -/// @return the option value -static Object get_option_from(void *from, int type, String name, Error *err) +/// @param[in] from Pointer to buffer or window for local option value. +/// @param req_scope Requested option scope. See OptReqScope in option.h. +/// @param name The option name. +/// @param[out] err Details of an error that may have occurred. +/// +/// @return the option value. +static Object get_option_from(void *from, OptReqScope req_scope, String name, Error *err) { - Object rv = OBJECT_INIT; - VALIDATE_S(name.size > 0, "option name", "", { - return rv; + return (Object)OBJECT_INIT; }); - // Return values - int64_t numval; - char *stringval = NULL; + OptVal value = get_option_value_strict(name.data, req_scope, from, err); + if (ERROR_SET(err)) { + return (Object)OBJECT_INIT; + } - int flags = get_option_value_strict(name.data, &numval, &stringval, type, from); - VALIDATE_S(flags != 0, "option name", name.data, { - return rv; + VALIDATE_S(value.type != kOptValTypeNil, "option name", name.data, { + return (Object)OBJECT_INIT; }); - if (flags & SOPT_BOOL) { - rv.type = kObjectTypeBoolean; - rv.data.boolean = numval ? true : false; - } else if (flags & SOPT_NUM) { - rv.type = kObjectTypeInteger; - rv.data.integer = numval; - } else if (flags & SOPT_STRING) { - if (!stringval) { - api_set_error(err, kErrorTypeException, "Failed to get option '%s'", name.data); - return rv; - } - rv.type = kObjectTypeString; - rv.data.string.data = stringval; - rv.data.string.size = strlen(stringval); - } else { - api_set_error(err, kErrorTypeException, "Unknown type for option '%s'", name.data); - } - - return rv; + return optval_as_object(value); } /// Sets the value of a global or local (buffer, window) option. /// -/// @param to If `type` is `SREQ_WIN` or `SREQ_BUF`, this must be a pointer -/// to the window or buffer. -/// @param type One of `SREQ_GLOBAL`, `SREQ_WIN` or `SREQ_BUF` -/// @param name The option name -/// @param[out] err Details of an error that may have occurred -static void set_option_to(uint64_t channel_id, void *to, int type, String name, Object value, - Error *err) +/// @param[in] to Pointer to buffer or window for local option value. +/// @param req_scope Requested option scope. See OptReqScope in option.h. +/// @param name The option name. +/// @param value New option value. +/// @param[out] err Details of an error that may have occurred. +static void set_option_to(uint64_t channel_id, void *to, OptReqScope req_scope, String name, + Object value, Error *err) { VALIDATE_S(name.size > 0, "option name", "", { return; }); - int flags = get_option_value_strict(name.data, NULL, NULL, type, to); + int flags = get_option_attrs(name.data); VALIDATE_S(flags != 0, "option name", name.data, { return; }); if (value.type == kObjectTypeNil) { - if (type == SREQ_GLOBAL) { + if (req_scope == kOptReqGlobal) { api_set_error(err, kErrorTypeException, "Cannot unset option '%s'", name.data); return; } else if (!(flags & SOPT_GLOBAL)) { @@ -716,35 +696,23 @@ static void set_option_to(uint64_t channel_id, void *to, int type, String name, } } - OptVal optval; + bool error = false; + OptVal optval = object_as_optval(value, &error); - if (flags & SOPT_BOOL) { - VALIDATE(value.type == kObjectTypeBoolean, "Option '%s' value must be Boolean", name.data, { - return; - }); - optval = BOOLEAN_OPTVAL(value.data.boolean); - } else if (flags & SOPT_NUM) { - VALIDATE(value.type == kObjectTypeInteger, "Option '%s' value must be Integer", name.data, { - return; - }); - VALIDATE((value.data.integer <= INT_MAX && value.data.integer >= INT_MIN), - "Option '%s' value is out of range", name.data, { - return; - }); - optval = NUMBER_OPTVAL((OptInt)value.data.integer); - } else { - VALIDATE(value.type == kObjectTypeString, "Option '%s' value must be String", name.data, { - return; - }); - optval = STRING_OPTVAL(value.data.string); - } + // Handle invalid option value type. + // Don't use `name` in the error message here, because `name` can be any String. + // No need to check if value type actually matches the types for the option, as set_option_value() + // already handles that. + VALIDATE_EXP(!error, "value", "valid option type", api_typename(value.type), { + return; + }); // For global-win-local options -> setlocal // For win-local options -> setglobal and setlocal (opt_flags == 0) - const int opt_flags = (type == SREQ_WIN && !(flags & SOPT_GLOBAL)) ? 0 : - (type == SREQ_GLOBAL) ? OPT_GLOBAL : OPT_LOCAL; + const int opt_flags = (req_scope == kOptReqWin && !(flags & SOPT_GLOBAL)) ? 0 : + (req_scope == kOptReqGlobal) ? OPT_GLOBAL : OPT_LOCAL; WITH_SCRIPT_CONTEXT(channel_id, { - set_option_value_for(name.data, optval, opt_flags, type, to, err); + set_option_value_for(name.data, optval, opt_flags, req_scope, to, err); }); } -- cgit From e19cc9c9b715d8171f7940632b8855104b5290b6 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Sat, 14 Oct 2023 22:19:11 +0600 Subject: refactor(options)!: unify `set_option` and `set_string_option` While the interfaces for setting number and boolean options are now unified by #25394, there is still a separate `set_string_option` function that is used for setting a string option. This PR removes that function and merges it with set_option. BREAKING CHANGE: `v:option_old` is now the old global value for all global-local options, instead of just string global-local options. Local value for a global-local number/boolean option is now unset when the option is set (e.g. using `:set` or `nvim_set_option_value`) without a scope, which means they now behave the same way as string options. Ref: #25672 --- src/nvim/api/deprecated.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 31ba20f627..59b7fc18d6 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -681,21 +681,6 @@ static void set_option_to(uint64_t channel_id, void *to, OptReqScope req_scope, return; }); - if (value.type == kObjectTypeNil) { - if (req_scope == kOptReqGlobal) { - api_set_error(err, kErrorTypeException, "Cannot unset option '%s'", name.data); - return; - } else if (!(flags & SOPT_GLOBAL)) { - api_set_error(err, kErrorTypeException, - "Cannot unset option '%s' because it doesn't have a global value", - name.data); - return; - } else { - unset_global_local_option(name.data, to); - return; - } - } - bool error = false; OptVal optval = object_as_optval(value, &error); -- cgit From 68cb4a7405ea9f8841d1f25ee8997c49e77fa679 Mon Sep 17 00:00:00 2001 From: bfredl Date: Fri, 3 Nov 2023 12:26:38 +0100 Subject: feat(extmarks): add "undo_restore" flag to opt out of undo-restoring It is a design goal of extmarks that they allow precise tracking of changes across undo/redo, including restore the exact positions after a do/undo or undo/redo cycle. However this behavior is not useful for all usecases. Many plugins won't keep marks around for long after text changes, but uses them more like a cache until some external source (like LSP semantic highlights) has fully updated to changed text and then will explicitly readjust/replace extmarks as needed. Add a "undo_restore" flag which is true by default (matches existing behavior) but can be set to false to opt-out of this behavior. Delete dead u_extmark_set() code. --- src/nvim/api/deprecated.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 59b7fc18d6..906edb7b44 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -172,8 +172,7 @@ Integer nvim_buf_set_virtual_text(Buffer buffer, Integer src_id, Integer line, A decor.virt_text_width = width; decor.priority = 0; - extmark_set(buf, ns_id, NULL, (int)line, 0, -1, -1, &decor, true, - false, kExtmarkNoUndo, NULL); + extmark_set(buf, ns_id, NULL, (int)line, 0, -1, -1, &decor, true, false, false, NULL); return src_id; } -- cgit From 4e6f559b8c5f77924fdbe2e5abd9c6aa8efad13f Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Tue, 24 Oct 2023 13:32:00 +0200 Subject: feat(extmarks): add 'invalidate' property to extmarks Problem: No way to have extmarks automatically removed when the range it is attached to is deleted. Solution: Add new 'invalidate' property that will hide a mark when the entirety of its range is deleted. When "undo_restore" is set to false, delete the mark from the buffer instead. --- src/nvim/api/deprecated.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 906edb7b44..8edb6dbd4f 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -172,7 +172,7 @@ Integer nvim_buf_set_virtual_text(Buffer buffer, Integer src_id, Integer line, A decor.virt_text_width = width; decor.priority = 0; - extmark_set(buf, ns_id, NULL, (int)line, 0, -1, -1, &decor, true, false, false, NULL); + extmark_set(buf, ns_id, NULL, (int)line, 0, -1, -1, &decor, true, false, false, false, NULL); return src_id; } -- cgit From 353a4be7e84fdc101318215bdcc8a7e780d737fe Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 12 Nov 2023 13:13:58 +0100 Subject: build: remove PVS We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable. --- src/nvim/api/deprecated.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 8edb6dbd4f..8398a3a5b1 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.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 #include #include -- cgit From bb4b4576e384c71890b4df4fa4f1ae76fad3a59d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 16 Nov 2023 10:55:54 +0800 Subject: refactor: iwyu (#26062) --- src/nvim/api/deprecated.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 8398a3a5b1..ff9f8ff18e 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -1,4 +1,3 @@ -#include #include #include #include -- cgit From a6e3d93421ba13c407a96fac9cc01fa41ec7ad98 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 16 Nov 2023 10:59:11 +0100 Subject: refactor: enable formatting for ternaries This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators. --- src/nvim/api/deprecated.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index ff9f8ff18e..849897b529 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -689,8 +689,9 @@ static void set_option_to(uint64_t channel_id, void *to, OptReqScope req_scope, // For global-win-local options -> setlocal // For win-local options -> setglobal and setlocal (opt_flags == 0) - const int opt_flags = (req_scope == kOptReqWin && !(flags & SOPT_GLOBAL)) ? 0 : - (req_scope == kOptReqGlobal) ? OPT_GLOBAL : OPT_LOCAL; + const int opt_flags = (req_scope == kOptReqWin && !(flags & SOPT_GLOBAL)) + ? 0 + : (req_scope == kOptReqGlobal) ? OPT_GLOBAL : OPT_LOCAL; WITH_SCRIPT_CONTEXT(channel_id, { set_option_value_for(name.data, optval, opt_flags, req_scope, to, err); -- cgit From 0b38fe4dbb77c15ae6f5779174855acab25fc86c Mon Sep 17 00:00:00 2001 From: bfredl Date: Wed, 8 Mar 2023 15:18:02 +0100 Subject: refactor(decorations): break up Decoration struct into smaller pieces Remove the monolithic Decoration struct. Before this change, each extmark could either represent just a hl_id + priority value as a inline decoration, or it would take a pointer to this monolitic 112 byte struct which has to be allocated. This change separates the decorations into two pieces: DecorSignHighlight for signs, highlights and simple set-flag decorations (like spell, ui-watched), and DecorVirtText for virtual text and lines. The main separation here is whether they are expected to allocate more memory. Currently this is not really true as sign text has to be an allocated string, but the plan is to get rid of this eventually (it can just be an array of two schar_T:s). Further refactors are expected to improve the representation of each decoration kind individually. The goal of this particular PR is to get things started by cutting the Gordian knot which was the monolithic struct Decoration. Now, each extmark can either contain chained indicies/pointers to these kinds of objects, or it can fit a subset of DecorSignHighlight inline. The point of this change is not only to make decorations smaller in memory. In fact, the main motivation is to later allow them to grow _larger_, but on a dynamic, on demand fashion. As a simple example, it would be possible to augment highlights to take a list of multiple `hl_group`:s, which then would trivially map to a chain of multiple DecorSignHighlight entries. One small feature improvement included with this refactor itself, is that the restriction that extmarks cannot be removed inside a decoration provider has been lifted. These are instead safely lifetime extended on a "to free" list until the current iteration of screen drawing is done. NB: flags is a mess. but DecorLevel is useless, this slightly less so --- src/nvim/api/deprecated.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 849897b529..b4aa6fe99e 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -154,21 +154,25 @@ Integer nvim_buf_set_virtual_text(Buffer buffer, Integer src_id, Integer line, A return 0; } - Decoration *existing = decor_find_virttext(buf, (int)line, ns_id); + DecorVirtText *existing = decor_find_virttext(buf, (int)line, ns_id); if (existing) { - clear_virttext(&existing->virt_text); - existing->virt_text = virt_text; - existing->virt_text_width = width; + clear_virttext(&existing->data.virt_text); + existing->data.virt_text = virt_text; + existing->width = width; return src_id; } - Decoration decor = DECORATION_INIT; - decor.virt_text = virt_text; - decor.virt_text_width = width; - decor.priority = 0; + DecorVirtText *vt = xmalloc(sizeof *vt); + *vt = (DecorVirtText)DECOR_VIRT_TEXT_INIT; + vt->data.virt_text = virt_text; + vt->width = width; + vt->priority = 0; - extmark_set(buf, ns_id, NULL, (int)line, 0, -1, -1, &decor, true, false, false, false, NULL); + DecorInline decor = { .ext = true, .data.ext.vt = vt, .data.ext.sh_idx = DECOR_ID_INVALID }; + + extmark_set(buf, ns_id, NULL, (int)line, 0, -1, -1, decor, 0, true, + false, false, false, NULL); return src_id; } -- cgit From a827003e3052c6d9ee7bdb71518182e9bd76317d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 25 Nov 2023 11:32:32 +0100 Subject: build: rework IWYU mapping files Create mapping to most of the C spec and some POSIX specific functions. This is more robust than relying files shipped with IWYU. --- src/nvim/api/deprecated.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index b4aa6fe99e..9ea0de4b89 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -13,6 +13,7 @@ #include "nvim/api/vimscript.h" #include "nvim/buffer_defs.h" #include "nvim/decoration.h" +#include "nvim/decoration_defs.h" #include "nvim/extmark.h" #include "nvim/globals.h" #include "nvim/highlight.h" @@ -21,7 +22,6 @@ #include "nvim/memory.h" #include "nvim/option.h" #include "nvim/pos.h" -#include "nvim/types.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "api/deprecated.c.generated.h" -- cgit From 6361806aa28edca55ad3316a58bc3e936df9c0eb Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 26 Nov 2023 22:58:52 +0800 Subject: refactor: move garray_T to garray_defs.h (#26227) --- src/nvim/api/deprecated.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 9ea0de4b89..47d3e1146c 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -13,7 +13,6 @@ #include "nvim/api/vimscript.h" #include "nvim/buffer_defs.h" #include "nvim/decoration.h" -#include "nvim/decoration_defs.h" #include "nvim/extmark.h" #include "nvim/globals.h" #include "nvim/highlight.h" -- cgit From 8b428ca8b79ebb7b36c3e403ff3bcb6924a635a6 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 16:00:21 +0100 Subject: build(IWYU): fix includes for func_attr.h --- src/nvim/api/deprecated.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 47d3e1146c..b57cf80c9f 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -14,6 +14,7 @@ #include "nvim/buffer_defs.h" #include "nvim/decoration.h" #include "nvim/extmark.h" +#include "nvim/func_attr.h" #include "nvim/globals.h" #include "nvim/highlight.h" #include "nvim/highlight_group.h" -- cgit From f4aedbae4cb1f206f5b7c6142697b71dd473059b Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 18:39:38 +0100 Subject: build(IWYU): fix includes for undo_defs.h --- src/nvim/api/deprecated.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index b57cf80c9f..cac7d1ded9 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -21,7 +21,7 @@ #include "nvim/lua/executor.h" #include "nvim/memory.h" #include "nvim/option.h" -#include "nvim/pos.h" +#include "nvim/pos_defs.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "api/deprecated.c.generated.h" -- cgit From e3f735ef101d670555f44226614a5c3557053b1f Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:13:32 +0100 Subject: refactor: fix includes for api/autocmd.h --- src/nvim/api/deprecated.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/api/deprecated.c') diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index cac7d1ded9..2ec11236d7 100644 --- a/src/nvim/api/deprecated.c +++ b/src/nvim/api/deprecated.c @@ -5,7 +5,7 @@ #include "nvim/api/buffer.h" #include "nvim/api/deprecated.h" #include "nvim/api/extmark.h" -#include "nvim/api/keysets.h" +#include "nvim/api/keysets_defs.h" #include "nvim/api/options.h" #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" -- cgit