aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
Commit message (Collapse)AuthorAge
* Merge remote-tracking branch 'upstream/master' into mix_20240309HEADrahmJosh Rahm2025-02-05
|\
| * feat(api): add err field to nvim_echo() optsLuuk van Baal2025-01-09
| | | | | | | | | | | | | | | | Problem: We want to deprecate `nvim_err_write(ln)()` but there is no obvious replacement (from Lua). Meanwhile we already have `nvim_echo()` with an `opts` argument. Solution: Add `err` argument to `nvim_echo()` that directly maps to `:echoerr`.
| * vim-patch:9.1.0984: exception handling can be improvedzeertzjq2025-01-07
| | | | | | | | | | | | | | | | | | | | | | | | Problem: exception handling can be improved Solution: add v:stacktrace and getstacktrace() closes: vim/vim#16360 https://github.com/vim/vim/commit/663d18d6102f40d14e36096ec590445e61026ed6 Co-authored-by: ichizok <gclient.gaap@gmail.com> Co-authored-by: Naruhiko Nishino <naru123456789@gmail.com>
| * feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343Justin M. Keyes2024-12-19
| | | | | | | | | | | | | | | | | | | | | | | | Problem: `termopen` has long been a superficial wrapper around `jobstart`, and has no real purpose. Also, `vim.system` and `nvim_open_term` presumably will replace all features of `jobstart` and `termopen`, so centralizing the logic will help with that. Solution: - Introduce `eval/deprecated.c`, where all deprecated eval funcs will live. - Introduce "term" flag of `jobstart`. - Deprecate `termopen`.
| * refactor(options): fix confusing naming of `scope` and `req_scope` (#31317)Famiu Haque2024-11-25
| | | | | | | | | | | | | | | | | | | | Problem: The name `scope` is often used to refer to option flags because `OPT_LOCAL` and `OPT_GLOBAL` are often used to determine the option scope. This leads to the name `req_scope` being used for actual option scopes instead. Solution: Since the end-goal is to remove `OPT_LOCAL` and `OPT_GLOBAL` entirely and replace them with `OptScope`, rename `OptScope` variables to `scope` and the old scope flag variables to `opt_flags`.
* | Merge remote-tracking branch 'upstream/master' into mix_20240309Josh Rahm2024-11-25
|\|
| * vim-patch:9.1.0870: too many strlen() calls in eval.c (#31267)zeertzjq2024-11-19
| | | | | | | | | | | | | | | | | | | | | | Problem: too many strlen() calls in eval.c Solution: Refactor eval.c to remove calls to STRLEN() (John Marriott) closes: vim/vim#16066 https://github.com/vim/vim/commit/bd4614f43d0eac4aff743132bab8e53b015ac801 Co-authored-by: John Marriott <basilisk@internode.on.net>
| * fix(messages): proper multiline Lua print() messages #31205luukvbaal2024-11-17
| | | | | | | | | | | | Problem: Separate message emitted for each newline present in Lua print() arguments. Solution: Make msg_multiline() handle NUL bytes. Refactor print() to use msg_multiline(). Refactor vim.print() to use print().
| * refactor(options): remove `.indir`, redesign option scopes #31066Famiu Haque2024-11-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The way option scopes currently work is inflexible and does not allow for nested option scopes or easily finding the value of an option at any arbitrary scope without having to do long handwritten switch-case statements like in `get_varp()`. `.indir` is also confusing and redundant since option indices for each scope can be autogenerated. Solution: Expand option scopes in such a way that an option can support any amount of scopes using a set of scope flags, similarly to how it's already done for option types. Also make options contain information about its index at each scope it supports. This allows for massively simplifying `get_varp()` and `get_varp_scope()` in the future by just using a struct for options at each scope. This would be done by creating a table that stores the offset of an option's variable at a scope by using the option's index at that scope as a key. This PR also autogenerates enums for option indices at each scope to remove the need for `.indir` entirely, and also to allow easily iterating over options all options that support any scope. Ref: #29314
| * fix(messages)!: vim.ui_attach message callbacks are unsafeLuuk van Baal2024-11-14
| | | | | | | | | | | | | | | | Problem: Lua callbacks for "msg_show" events with vim.ui_attach() are executed when it is not safe. Solution: Disallow non-fast API calls for "msg_show" event callbacks. Automatically detach callback after excessive errors. Make sure fast APIs do not modify Nvim state.
| * refactor(message): propagate highlight id instead of attrsLuuk van Baal2024-11-08
| | | | | | | | | | | | | | Problem: Highlight group id is not propagated to the end of the message call stack, where ext_messages are emitted. Solution: Refactor message functions to pass along highlight group id instead of attr id.
| * vim-patch:9.1.0831: 'findexpr' can't be used as lambad or Funcref (#31058)zeertzjq2024-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 'findexpr' can't be used for lambads (Justin Keyes) Solution: Replace the findexpr option with the findfunc option (Yegappan Lakshmanan) related: vim/vim#15905 closes: vim/vim#15976 https://github.com/vim/vim/commit/a13f3a4f5de9c150f70298850e34747838904995 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:9.1.0821: 'findexpr' completion doesn't set v:fname to cmdline ↵zeertzjq2024-10-29
| | | | | | | | | | | | | | | | | | | | | | argument Problem: 'findexpr' completion doesn't set v:fname to cmdline argument. Solution: Set v:fname to the cmdline argument as-is (zeertzjq). closes: vim/vim#15934 https://github.com/vim/vim/commit/20e045f78148c0ef0143c33ffe686fee72d29376
| * vim-patch:9.1.0810: cannot easily adjust the |:find| commandzeertzjq2024-10-29
| | | | | | | | | | | | | | | | | | | | | | | | Problem: cannot easily adjust the |:find| command Solution: Add support for the 'findexpr' option (Yegappan Lakshmanan) closes: vim/vim#15901 closes: vim/vim#15905 https://github.com/vim/vim/commit/aeb1c97db5b9de4f4903e7f288f2aa5ad6c49440 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * refactor(eval): fix clear_evalarg() called with wrong argument (#30899)zeertzjq2024-10-22
| |
* | Merge remote-tracking branch 'upstream/master' into mix_20240309Josh Rahm2024-11-19
|\|
| * refactor: rename "process" => "proc" #30387Justin M. Keyes2024-09-15
| | | | | | | | | | | | | | | | | | | | | | | | Problem: - "process" is often used as a verb (`multiqueue_process_events`), which is ambiguous for cases where it's used as a topic. - The documented naming convention for processes is "proc". - `:help dev-name-common` - Shorter is better, when it doesn't harm readability or discoverability. Solution: Rename "process" => "proc" in all C symbols and module names.
| * refactor: extract eval/fs.c from eval/funcs.c (#29985)zeertzjq2024-08-06
| | | | | | | | | | | | In Vim a lot of filesystem functions have been moved to filepath.c. However, some of these functions actually deal with file contents, and Nvim's filesystem-related functions are spread out in a different way. Therefore, it's better to use a different file for these functions.
| * refactor(shada): rework msgpack decoding without msgpack-cbfredl2024-08-05
| | | | | | | | | | | | | | This also makes shada reading slightly faster due to avoiding some copying and allocation. Use keysets to drive decoding of msgpack maps for shada entries.
| * refactor: move some functions out of eval.c (#29964)zeertzjq2024-08-02
| | | | | | | | | | | | - common_function() has always been in evalfunc.c in Vim - return_register() has always been in evalfunc.c in Vim - get_user_input() was moved to ex_getln.c in Vim 8.1.1957 - tv_get_lnum_buf() was moved to typval.c in Vim 8.2.0847
| * fix(eval): handle wrong v:lua in expr option properly (#29953)zeertzjq2024-08-02
| |
| * refactor(eval): treat v:lua call as simple functionzeertzjq2024-08-02
| |
| * vim-patch:9.1.0649: Wrong comment for "len" argument of call_simple_func()zeertzjq2024-08-02
| | | | | | | | | | | | | | | | | | | | Problem: Wrong comment for "len" argument of call_simple_func(). Solution: Remove the "or -1 to use strlen()". Also change its type to size_t to remove one cast. (zeertzjq) closes: vim/vim#15410 https://github.com/vim/vim/commit/c1ed788c1b41db9b5f1ef548dc877f771f535bbe
| * vim-patch:9.0.0634: evaluating "expr" options has more overhead than neededzeertzjq2024-08-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Evaluating "expr" options has more overhead than needed. Solution: Use call_simple_func() for 'foldtext', 'includeexpr', 'printexpr', "expr" of 'spellsuggest', 'diffexpr', 'patchexpr', 'balloonexpr', 'formatexpr', 'indentexpr' and 'charconvert'. https://github.com/vim/vim/commit/a4e0b9785e409e9e660171cea76dfcc5fdafad9b vim-patch:9.0.0635: build error and compiler warnings Problem: Build error and compiler warnings. Solution: Add missing change. Add type casts. https://github.com/vim/vim/commit/3292a229402c9892f5ab90645fbfe2b1db342f5b Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0632: calling a function from an "expr" option has overheadzeertzjq2024-08-02
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Calling a function from an "expr" option has too much overhead. Solution: Add call_simple_func() and use it for 'foldexpr' https://github.com/vim/vim/commit/87b4e5c5db9d1cfd6f2e79656e1a6cff3c69d15f Cherry-pick a call_func() change from patch 8.2.1343. Add expr-option-function docs to options.txt. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:partial:9.1.0462: eval5() and eval7 are too complexzeertzjq2024-08-01
| | | | | | | | | | | | | | | | | | | | | | | | Problem: eval5() and eval7 are too complex Solution: Refactor eval5() and eval7() in eval.c (Yegappan Lakshmanan) closes: vim/vim#14900 https://github.com/vim/vim/commit/734286e4c626f80ace27eeb252a5e384e798aebf Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:partial:9.1.0450: evalc. code too complexzeertzjq2024-08-01
| | | | | | | | | | | | | | | | | | | | | | | | Problem: eval.c code too complex Solution: refactor eval6() and eval9() functions into several smaller functions (Yegappan Lakshmanan) closes: vim/vim#14875 https://github.com/vim/vim/commit/51c45e89b50a4841147b9fbd7c6095ab79a10c71 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:9.1.0411: too long functions in eval.c (#29925)zeertzjq2024-07-31
| | | | | | | | | | | | | | | | | | | | | | | | Problem: too long functions in eval.c Solution: refactor functions (Yegappan Lakshmanan) closes: vim/vim#14755 https://github.com/vim/vim/commit/4ceb4dc825854032eed423ec1fc372317d3420bf The remaining eval_expr_typval() changes. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:partial:9.1.0445: Coverity warning after 9.1.0440zeertzjq2024-07-31
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Coverity warning after 9.1.0440 Solution: Fix Coverity warning, add a test and reduce the calls to clear_tv() (Yegappan Lakshmanan). closes: vim/vim#14845 https://github.com/vim/vim/commit/dbac0da631c66869f41c3c573ad7a8cfef95964d Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:9.1.0415: Some functions are not testedzeertzjq2024-07-31
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Some functions are not tested Solution: Add a few more tests, fix a few minor problems (Yegappan Lakshmanan) closes: vim/vim#14789 https://github.com/vim/vim/commit/fe424d13ef6e5486923f23f15bb6951e3079412e Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:partial:9.1.0411: too long functions in eval.czeertzjq2024-07-31
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: too long functions in eval.c Solution: refactor functions (Yegappan Lakshmanan) closes: vim/vim#14755 https://github.com/vim/vim/commit/4ceb4dc825854032eed423ec1fc372317d3420bf Skip the eval_expr_typval() changes. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:8.2.4115: cannot use a method with a complex expressionzeertzjq2024-07-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Cannot use a method with a complex expression. Solution: Evaluate the expression after "->" and use the result. https://github.com/vim/vim/commit/c665dabdf4c49a0fbf1dc566253c75c2abe2effa Cherry-pick a "verbose" check from patch 8.2.4123. N/A patches for version.c: vim-patch:8.2.4102: Vim9: import cannot be used after method vim-patch:8.2.4110: Coverity warns for using NULL pointer Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.2.1731: Vim9: cannot use += to append to empty NULL listzeertzjq2024-07-31
| | | | | | | | | | | | | | | | | | Problem: Vim9: cannot use += to append to empty NULL list. Solution: Copy the list instead of extending it. (closes vim/vim#6998) https://github.com/vim/vim/commit/81ed4960482f8baabdd7f95b4d5e39744be88ae7 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.1.0524: the recursive parameter in the *_equal functions can be ↵zeertzjq2024-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | removed (#29572) Problem: the recursive parameter in the *_equal functions can be removed Solution: Remove the recursive parameter in dict_equal(), list_equal() object_equal and tv_equal(). Use a comparison of the static var recursive_cnt == 0 to determine whether or not tv_equal() has been called recursively (Yinzuo Jiang). closes: vim/vim#15070 https://github.com/vim/vim/commit/7ccd1a2e858dbb2ac7fb09971dfcbfad62baa677 Co-authored-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
| * refactor(typval)!: remove distinction of binary and nonbinary stringsbfredl2024-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a breaking change which will make refactor of typval and shada code a lot easier. In particular, code that would use or check for v:msgpack_types.binary in the wild would be broken. This appears to be rarely used in existing plugins. Also some cases where v:msgpack_type.string would be used to represent a binary string of "string" type, we use a BLOB instead, which is vimscripts native type for binary blobs, and already was used for BIN formats when necessary. msgpackdump(msgpackparse(data)) no longer preserves the distinction of BIN and STR strings. This is very common behavior for language-specific msgpack bindings. Nvim uses msgpack as a tool to serialize its data. Nvim is not a tool to bit-perfectly manipulate arbitrary msgpack data out in the wild. The changed tests should indicate how behavior changes in various edge cases.
| * revert: "refactor: use S_LEN macro" (#29319)Lewis Russell2024-06-14
| | | | | | | | | | revert: "refactor: use S_LEN(s) instead of s, n (#29219)" This reverts commit c37695a5d5f2e8914fff86f3581bed70b4c85d3c.
| * Merge pull request #29278 from bfredl/strcatbfredl2024-06-11
| |\ | | | | | | refactor(memory): use builtin strcat() instead of STRCAT()
| | * refactor(memory): use builtin strcat() instead of STRCAT()bfredl2024-06-11
| | | | | | | | | | | | | | | | | | | | | | | | The latter was mostly relevant with the past char_u madness. NOTE: STRCAT also functioned as a counterfeit "NOLINT" for clint apparently. But NOLINT-ing every usecase is just the same as disabling the check entirely.
| * | refactor: use S_LEN(s) instead of s, n (#29219)James2024-06-11
| |/
| * refactor: replace '\0' with NULJames Tirta Halim2024-06-04
| |
| * refactor: move shared messages to errors.h #26214Justin M. Keyes2024-06-01
| |
* | Merge remote-tracking branch 'upstream/master' into mix_20240309Josh Rahm2024-05-24
|\|
| * vim-patch:9.1.0440: function get_lval() is too long (#28963)zeertzjq2024-05-24
| | | | | | | | | | | | | | | | | | | | | | Problem: function get_lval() is too long Solution: factor out the get_lval_subscript() function (Yegappan Lakshmanan) closes: vim/vim#14839 https://github.com/vim/vim/commit/44cadaa18c1816f7a576f1870790ee01a23c1071 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:8.2.3158: strange error message when using islocked() with a ↵zeertzjq2024-05-24
| | | | | | | | | | | | | | | | | | | | | | | | | | number (#28962) Problem: Strange error message when using islocked() with a number. (Yegappan Lakshmanan) Solution: Check that the name is empty. https://github.com/vim/vim/commit/1840a7b4e3577e617f724c9d07ccc78195cc010a Use ll_name_len instead. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.1175: the set_ref_in_item() function is too long (#28926)zeertzjq2024-05-23
| | | | | | | | | | | | | | | | | | Problem: The set_ref_in_item() function is too long. Solution: Use a separate function for more complicated types. (Yegappan Lakshmanan, closes vim/vim#11802) https://github.com/vim/vim/commit/ea125393af01ecaf75cee8e085a57f8143f3ae3e Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:8.2.0703: Vim9: closure cannot store value in outer context (#28925)zeertzjq2024-05-23
| | | | | | | | | | | | | | | | | | | | | | Problem: Vim9: closure cannot store value in outer context. Solution: Make storing value in outer context work. Make :disassemble accept a function reference. https://github.com/vim/vim/commit/b68b346e6db6d3f848e0a89905fcd7777b73c5d8 Funcstack is Vim9script-only. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * Merge pull request #28492 from bfredl/hotfixbfredl2024-04-25
| |\ | | | | | | fix(lua): vim.fn.has('nvim-0.10') in fast context, used by vim.deprecate
| | * fix(lua): vim.fn.has('nvim-0.10') in fast context, used by vim.deprecatebfredl2024-04-25
| | |
| * | refactor(source): remove unnecessary concatenation with Lua (#28499)zeertzjq2024-04-25
| |/
| * vim-patch:9.1.0335: String interpolation fails for List type (#28364)zeertzjq2024-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: String interpolation fails for List type Solution: use implicit string(list) for string interpolation and :put = (Yegappan Lakshmanan) related: vim/vim#14529 closes: vim/vim#14556 https://github.com/vim/vim/commit/bce51d9005dd1c5bc002acbac2e12b649abcb013 Cherry-pick eval_to_string_eap() from patch 8.2.1914. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>