aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/userfunc.c
Commit message (Collapse)AuthorAge
* Change from char_u to charfix_repeatcmdlineJosh Rahm2023-11-29
|
* Merge remote-tracking branch 'upstream/master' into fix_repeatcmdlineJosh Rahm2023-11-29
|\
| * refactor: fix headers with IWYUdundargoc2023-11-28
| |
| * refactor: move hashtab types to hashtab_defs.h (#26262)zeertzjq2023-11-28
| |
| * refactor: rename types.h to types_defs.hdundargoc2023-11-27
| |
| * build(IWYU): fix includes for func_attr.hdundargoc2023-11-27
| |
| * refactor: move Arena and ArenaMem to memory_defs.h (#26240)zeertzjq2023-11-27
| |
| * refactor: move garray_T to garray_defs.h (#26227)zeertzjq2023-11-26
| |
| * refactor: remove __clang_analyzer__ macrodundargoc2023-11-21
| | | | | | | | | | It is less intrusive to silence the warning with a comment instead of a macro if needed.
| * refactor: enable formatting for ternariesdundargoc2023-11-20
| | | | | | | | | | | | This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators.
| * refactor: follow style guidedundargoc2023-11-19
| | | | | | | | | | - reduce variable scope - prefer initialization over declaration and assignment
| * build: remove PVSdundargoc2023-11-12
| | | | | | | | | | | | | | 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.
| * refactor: remove redundant castsdundargoc2023-11-11
| |
| * refactor: change some xstrndup() and xstrnsave() to xmemdupz() (#25959)zeertzjq2023-11-10
| | | | | | | | When the given length is exactly the number of bytes to copy, xmemdupz() makes the intention clearer.
| * refactor: the long goodbyedundargoc2023-11-05
| | | | | | | | | | | | long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types.
| * vim-patch:9.0.2050: Vim9: crash with deferred function call and exception ↵zeertzjq2023-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#25715) Problem: Vim9: crash with deferred function call and exception Solution: Save and restore exception state Crash when a deferred function is called after an exception and another exception is thrown closes: vim/vim#13376 closes: vim/vim#13377 https://github.com/vim/vim/commit/c59c1e0d88651a71ece7366e418f1253abbe2a28 The change in check_due_timer() is N/A as Nvim calls timer callbacks on the main loop. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * vim-patch:9.0.2044: Vim9: exceptions confuse defered functionszeertzjq2023-10-18
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Vim9: exceptions confuse defered functions Solution: save and restore exception state when calling defered functions closes: vim/vim#13364 closes: vim/vim#13372 https://github.com/vim/vim/commit/0672595fd50e9ae668676a40e28ebf66d7f52392 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * feat: ignore swapfile for running Nvim processes #25336Justin M. Keyes2023-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The swapfile "E325: ATTENTION" dialog is displayed when editing a file already open in another (running) Nvim. Usually this behavior is annoying and irrelevant: - "Recover" and the other options ("Open readonly", "Quit", "Abort") are almost never wanted. - swapfiles are less relevant for "multi-Nvim" since 'autoread' is enabled by default. - Even less relevant if user enables 'autowrite'. Solution: Define a default SwapExists handler which does the following: 1. If the swapfile is owned by a running Nvim process, automatically chooses "(E)dit anyway" (caveat: this creates a new, extra swapfile, which is mostly harmless and ignored except by `:recover` or `nvim -r`. 2. Shows a 1-line "ignoring swapfile..." message. 3. Users can disable the default SwapExists handler via `autocmd! nvim_swapfile`.
| * refactor: the long goodbyedundargoc2023-10-03
| | | | | | | | | | | | long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types.
| * refactor: move cmdline completion types to cmdexpand_defs.h (#25465)zeertzjq2023-10-02
| |
| * refactor: reorganize option header files (#25437)zeertzjq2023-09-30
| | | | | | | | | | | | - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other
| * build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
| |
| * refactor(message): smsg_attr -> smsgbfredl2023-09-29
| |
| * fix: use snprintf instead of sprintfLewis Russell2023-08-31
| | | | | | | | Clang 14 now reports sprintf as deprecated.
| * refactor: use xstrl{cpy,cat} on IObuff (#23648)ii142023-05-16
| | | | | | | | | | Replace usage of STR{CPY,CAT} with xstrl{cpy,cat} when using on IObuff Co-authored-by: ii14 <ii14@users.noreply.github.com>
| * vim-patch:8.2.4075: test failureszeertzjq2023-05-08
| | | | | | | | | | | | | | | | | | | | | | Problem: Test failures. Solution: Change check for NULL pointer. https://github.com/vim/vim/commit/78a70533c3707aa50cbf998c7807221945aa9787 :export is N/A. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.4073: Coverity warns for using NULL pointerzeertzjq2023-05-08
| | | | | | | | | | | | | | | | | | | | Problem: Coverity warns for using NULL pointer. Solution: Bail out when running out of memory. Check for running over end of a string. https://github.com/vim/vim/commit/54598066ca4cfaf0761aedf47e4ba9844674791e Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.1697: inconsistent capitalization of error messages (#23476)zeertzjq2023-05-04
| | | | | | | | | | | | | | | | | | | | Problem: Inconsistent capitalization of error messages. Solution: Always start with a capital. https://github.com/vim/vim/commit/7707228aace9aff16434edf5377a354c6ad07316 Most of these errors are Vim9 script only. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.1505: error when heredoc content looks like heredoc (#23446)zeertzjq2023-05-03
| | | | | | | | | | | | Problem: Error when heredoc content looks like heredoc. Solution: Handle curly expressions. (closes vim/vim#12325) https://github.com/vim/vim/commit/a93d9cdc74f70ca2c85781496ffae4ca738fcd88
| * vim-patch:8.2.0578: heredoc for interfaces does not support "trim"zeertzjq2023-04-29
| | | | | | | | | | | | | | | | Problem: Heredoc for interfaces does not support "trim". Solution: Update the script heredoc support to be same as the :let command. (Yegappan Lakshmanan, closes vim/vim#5916) https://github.com/vim/vim/commit/6c2b7b8055b96463f78abb70f58c4c6d6d4b9d55
| * refactor: uncrustifydundargoc2023-04-26
| | | | | | | | Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`.
| * vim-patch:9.0.0875: using freed memory when executing delfunc at more prompt ↵zeertzjq2023-04-25
| | | | | | | | | | | | | | | | | | | | (#23314) Problem: Using freed memory when executing delfunc at the more prompt. Solution: Check function list not changed in another place. (closes vim/vim#11437) https://github.com/vim/vim/commit/398a26f7fcd58fbc6e2329f892edbb7479a971bb Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * fix(userfunc): fix possible out of bound accessAndreas Schneider2023-04-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In file included from /usr/include/string.h:535, from gsrc/nvim/eval/userfunc.c:11: In function ‘strcpy’, inlined from ‘cat_func_name’ at gsrc/nvim/eval/userfunc.c:662:5, inlined from ‘get_user_func_name’ at gsrc/nvim/eval/userfunc.c:2854:5: /usr/include/bits/string_fortified.h:79:10: warning: ‘__builtin___strcpy_chk’ offset 0 from the object at ‘<unknown>’ is out of the bounds of referenced subobject ‘uf_name’ with ty pe ‘char[]’ at offset 0 [-Warray-bounds=] 79 | return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from gsrc/nvim/eval/typval.h:10, from gsrc/nvim/buffer_defs.h:20, from gsrc/nvim/autocmd.h:8, from gsrc/nvim/eval/userfunc.c:15: gsrc/nvim/eval/typval_defs.h: In function ‘get_user_func_name’: gsrc/nvim/eval/typval_defs.h:342:8: note: subobject ‘uf_name’ declared here 342 | char uf_name[]; ///< Name of function (actual size equals name); | ^~~~~~~
| * vim-patch:9.0.1470: deferred functions invoked in unexpected order (#23199)zeertzjq2023-04-19
| | | | | | | | | | | | | | | | Problem: Deferred functions invoked in unexpected order when using :qa and autocommands. Solution: Call deferred functions for the current funccal before using the stack. (closes vim/vim#12278) https://github.com/vim/vim/commit/1be4b81bfb3d7edf0e2ae41711d429e8fa5e0555
| * vim-patch:9.0.1469: deferred functions not called from autocommandszeertzjq2023-04-19
| | | | | | | | | | | | | | Problem: Deferred functions not called from autocommands. Solution: Also go through the funccal_stack. (closes vim/vim#12267) https://github.com/vim/vim/commit/960cf9119e3f4922ca9719feb5e0c0bc5e3b9840
| * vim-patch:9.0.1462: recursively calling :defer function if it does :qazeertzjq2023-04-19
| | | | | | | | | | | | | | | | | | Problem: Recursively calling :defer function if it does :qa. Solution: Clear the defer entry before calling the function. (closes vim/vim#12266) https://github.com/vim/vim/commit/42994bf678f46dc9ca66e49f512261da8864fff6 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0864: crash when using "!!" without a previous shell commandzeertzjq2023-04-18
| | | | | | | | | | | | | | | | | | Problem: Crash when using "!!" without a previous shell command. Solution: Check "prevcmd" is not NULL. (closes vim/vim#11487) https://github.com/vim/vim/commit/6600447c7b0a1be3a64d07a318bacdfaae0cac4b Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * refactor: suppress clang false positives (#23154)zeertzjq2023-04-17
| |
| * vim-patch:9.0.0419: the :defer command does not check the function argumentszeertzjq2023-04-17
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The :defer command does not check the function argument count and types. Solution: Check the function arguments when adding a deferred function. https://github.com/vim/vim/commit/169003289fb4b2ad18fd7f5807e0d05efff0be85 Cherry-pick check_internal_func() from Vim, but use EvalFuncDef pointer as first argument. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0406: deferred functions not invoked when partial func exitszeertzjq2023-04-17
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Deferred functions not invoked when partial func exits. Solution: Create a funccall_T when calling a :def function. https://github.com/vim/vim/commit/9667b2c888351b04751bdb43cba0d4ffc8c13ab1 The remove_funccal() function is currently unused, but it will be used in patch 9.0.0618. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.2172: Vim9: number of arguments is not always checked (#23142)zeertzjq2023-04-17
| | | | | | | | | | | | | | | | | | Problem: Vim9: number of arguments is not always checked. (Yegappan Lakshmanan) Solution: Check number of arguments when calling function by name. https://github.com/vim/vim/commit/5082471f91dd42ed8c35e0f649d0a6572e6fe3fc Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0398: members of funccall_T are inconsistently named (#23123)zeertzjq2023-04-16
| | | | | | | | | | | | | | | | Problem: Members of funccall_T are inconsistently named. Solution: Use the "fc_" prefix for all members. https://github.com/vim/vim/commit/ca16c60f337ed33d5dd66a6e90aaf95b619c5e47 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.1446: unnecessary checks for the "skip" flag when skippingzeertzjq2023-04-16
| | | | | | | | | | | | | | Problem: Unnecessary checks for the "skip" flag when skipping. Solution: Remove the unnecessary checks. (closes vim/vim#12254) https://github.com/vim/vim/commit/5299c0933f942c61bfd48064c91365e518fa868c
| * vim-patch:9.0.0411: only created files can be cleaned up with one callzeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Only created files can be cleaned up with one call. Solution: Add flags to mkdir() to delete with a deferred function. Expand the writefile() name to a full path to handle changing directory. https://github.com/vim/vim/commit/6f14da15ac900589f2f413d77898b9bff3b31ece vim-patch:8.2.3742: dec mouse test fails without gnome terminfo entry Problem: Dec mouse test fails without gnome terminfo entry. Solution: Check if there is a gnome entry. Also fix 'acd' test on MS-Windows. (Dominique Pellé, closes vim/vim#9282) https://github.com/vim/vim/commit/f589fd3e1047cdf90566b68aaf9a13389e54d26a Cherry-pick test_autochdir.vim changes from patch 9.0.0313. Cherry-pick test_autocmd.vim changes from patch 9.0.0323. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0397: :defer not tested with exceptions and ":qa!"zeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | | | Problem: :defer not tested with exceptions and ":qa!". Solution: Test :defer works when exceptions are thrown and when ":qa!" is used. Invoke the deferred calls on exit. https://github.com/vim/vim/commit/58779858fb5a82a3233af5d4237a3cece88c10d4 Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0390: cannot use a partial with :deferzeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | | | Problem: Cannot use a partial with :defer. Solution: Add the partial arguments before the other arguments. Disallow using a dictionary. https://github.com/vim/vim/commit/86d87256c4005c6215da5af2597fbf6f6304421f Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0379: cleaning up after writefile() is a hasslezeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | | | Problem: Cleaning up after writefile() is a hassle. Solution: Add the 'D' flag to defer deleting the written file. Very useful in tests. https://github.com/vim/vim/commit/806a273f3c84ecd475913d901890bb1929be9a0a Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:9.0.0370: cleaning up afterwards can make a function messyzeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Cleaning up afterwards can make a function messy. Solution: Add the :defer command. https://github.com/vim/vim/commit/1d84f7608f1e41dad03b8cc7925895437775f7c0 Omit EX_EXPR_ARG: Vim9 script only. Make :def throw E319 to avoid confusing behavior. Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * vim-patch:8.2.3783: confusing error for using a variable as a functionzeertzjq2023-04-16
| | | | | | | | | | | | | | | | | | | | Problem: Confusing error for using a variable as a function. Solution: If a function is not found but there is a variable, give a more useful error. (issue vim/vim#9310) https://github.com/vim/vim/commit/2ef9156b4284e4a52613c36e3d4667245273a28d Co-authored-by: Bram Moolenaar <Bram@vim.org>
| * refactor: remove FC_DEADzeertzjq2023-04-15
| | | | | | | | It's for Vim9 script only.