aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
Commit message (Collapse)AuthorAge
...
* vim-patch:8.2.0175: crash when removing list element in map()Sean Dewar2022-01-18
| | | | | | Problem: Crash when removing list element in map(). Solution: Lock the list. (closes vim/vim#2652) https://github.com/vim/vim/commit/db661fb95dc41b7a9438cf3cd4e77f8410bc81c0
* feat(api): add support for lua function & description in keymapshadmansaleh2022-01-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Behavioral changes: 1. Added support for lua function in keymaps in -------------------------------------------- - nvim_set_keymap Can set lua function as keymap rhs like following: ```lua vim.api.nvim_{buf_}set_keymap('n', '<leader>lr', '', {callback = vim.lsp.buf.references}) ``` Note: lua function can only be set from lua . If api function being called from viml or over rpc this option isn't available. - nvim_{buf_}get_keymap When called from lua, lua function is returned is `callback` key . But in other cases callback contains number of the function ref. - :umap, nvim_del_keymap & nvim_buf_del_keymap clears lua keymaps correctly. - :map commands for displaing rhs . For lua keymaps rhs is displayed as <Lua function ref_no> Note: lua keymap cannot be set through viml command / functions. - mapargs() When dict is false it returns string in `<Lua function ref_no>` format (same format as :map commands). When dict is true it returns ref_no number in `callback` key. - mapcheck() returns string in `<Lua function ref_no>` format (same format as :map commands). 2. Added support for keymap description --------------------------------------- - nvim_{buf_}set_keymap: added `desc` option in opts table . ```lua vim.api.nvim_set_keymap('n', '<leader>w', '<cmd>w<cr>', {desc='Save current file'}) ``` - nvim_{buf_}get_keymap: contains `desc` in returned list. - commands like `:nmap <leader>w` will show description in a new line below rhs. - `maparg()` return dict contains `desc`.
* refactor(misc1): move out high-level input functions to a new file: input.cBjörn Linse2021-12-10
| | | | | Possibly dialog code is messages.c could be moved here as well. misc1.c is now empty, so delete it.
* refactor(misc1): move out autocmd related functionsBjörn Linse2021-12-09
|
* Merge pull request #16107 from zeertzjq/vim-8.1.1542Jan Edmund Lazo2021-12-06
|\ | | | | vim-patch:8.1.1542,8.2.3549: an OptionSet autocommand does not get enough info
| * vim-patch:8.1.1542: an OptionSet autocommand does not get enough infozeertzjq2021-11-22
| | | | | | | | | | | | | | Problem: An OptionSet autocommand does not get enough info. Solution: Add v:option_command, v:option_oldlocal and v:option_oldglobal. (Latrice Wilgus, closes vim/vim#4118) https://github.com/vim/vim/commit/d7c968794710f338d491072171df48f96612cf72
* | lint (#16526)Jan Edmund Lazo2021-12-05
| |
* | feat(api): add nvim_get_option_valueGregory Anders2021-12-04
| |
* | refactor: upgrade uncrustify config version to 0.74.0Dundar Göc2021-11-23
|/ | | | | Disable formatting for assert.h since there's a bug that results in a segmentation fault in uncrustify.
* vim-patch:8.2.3627: difficult to know where the text starts in a window (#16377)zeertzjq2021-11-21
| | | | | | | | | | | vim-patch:8.2.3627: difficult to know where the text starts in a window Problem: difficult to know where the text starts in a window. (Sergey Vlasov) Solution: Add the "textoff" entry in the result of getwininfo(). (closes vim/vim#9163) https://github.com/vim/vim/commit/cdf5fdb2948ecdd24c6a1e27ed33dfa847c2b3e4 Fix indent in Test_getbufwintabinfo().
* refactor: saner options for uncrustify (#16204)dundargoc2021-11-19
| | | | | | | | | | | | | | | | | | | | | | | | * sp_enum_after_assign = force * sp_brace_typedef = force * nl_do_brace = remove * sp_do_brace_open = force * sp_brace_close_while = force * sp_before_semi = remove * sp_before_semi_for = remove * sp_before_semi_for_empty = remove * sp_between_semi_for_empty = remove * sp_after_semi_for_empty = remove * sp_before_square = remove * sp_before_squares = remove * sp_inside_square = remove * sp_inside_fparens = remove * sp_inside_fparen = remove * sp_inside_tparen = remove * sp_after_tparen_close = remove * sp_return_paren = force * pos_bool = lead * sp_pp_concat = remove * sp_pp_stringify = remove * fixup: disable formatting for the INIT section
* refactor(macroman): get rid of MB_COPY_CHAR macroBjörn Linse2021-11-14
| | | | clean up docs for MB_PTR_ADV and MB_PTR_BACK
* vim-patch:8.1.0779: argument for message functions is inconsistentJames McCoy2021-11-01
| | | | | | Problem: Argument for message functions is inconsistent. Solution: Make first argument to msg() "char *". https://github.com/vim/vim/commit/32526b3c1846025f0e655f41efd4e5428da16b6c
* vim-patch:8.1.0743: giving error messages is not flexibleJames McCoy2021-11-01
| | | | | | | | | Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
* refactor: saner options for uncrustify #16196dundargoc2021-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * refactor: general good option changes sp_deref = remove sp_not = remove sp_inv = remove sp_inside_paren_cast = remove mod_remove_duplicate_include = true sp_after_semi = add sp_after_semi_for = force sp_sizeof_paren = remove nl_return_expr = remove nl_else_brace = remove nl_else_if = remove * refactor: mod_remove_extra_semicolon = true * refactor: nl_max = 3 * refactor: sp_bool = force * refactor: sp_compare = force * refactor: sp_inside_paren = remove * refactor: sp_paren_paren = remove * refactor: sp_inside_sparen = remove * refactor: sp_before_sparen = force * refactor: sp_sign = remove * refactor: sp_addr = remove * refactor: sp_member = remove * refactor: nl_struct_brace = remove * refactor: nl_before_if_closing_paren = remove * refactor: nl_fdef_brace = force * refactor: sp_paren_comma = force * refactor: mod_full_brace_do = add
* vim-patch:8.1.2378: using old C style commentsDundar Göc2021-10-21
| | | | | | Problem: Using old C style comments. Solution: Use // comments where appropriate. https://github.com/vim/vim/commit/5d18efecfd6c45d69f55268948a22cd0465bb955
* Merge #15994 feat(:source, nvim_exec): script-local scopeJustin M. Keyes2021-10-17
|\
| * feat(:source, nvim_exec): defer script item creation until s:var accessSean Dewar2021-10-14
| | | | | | | | | | | | | | | | For anonymous scripts, defer the creation of script items until an attempt to access a script-local variable is made. This dramatically reduces the number of script items created when using lots of vim.cmd and nvim_exec especially. This will mean <SID> usage fails until a script-local variable access is first made.
* | refactor: reduce number of unique char castsDundar Göc2021-10-13
|/
* refactor: reduce number of unique char casts (#15995)dundargoc2021-10-12
|
* refactor: remove redundant char casts #15888dundargoc2021-10-04
|
* refactor: replace sprintf with snprintf #15794dundargoc2021-09-26
|
* refactor: format with uncrustify #15778dundargoc2021-09-25
| | | * fixup: force exactly one whitespace between type and variable
* fix(PVS V576): false positiveJustin M. Keyes2021-09-24
| | | | | `lower`, `upper` are `varnumber_T`, correctly matched to `PRIdVARNUMBER` format.
* refactor: reformat with uncrustify #15736dundargoc2021-09-20
| | | | * fix function parameter comments * remove space after star in function names
* refactor: format with uncrustify #15726dundargoc2021-09-20
|
* refactor: convert TRUE/FALSE to true/false (#15660)dundargoc2021-09-18
|
* fix(eval): partially port v8.2.3284Sean Dewar2021-09-16
| | | | | | | | | | | | | These were issues that I found while porting that I fixed upstream. :^) Very little of the patch can be exactly ported as we're a bit behind on dependant patches (we also can't use the exact :for emsg, as we don't support iterating over Strings yet), so just translate the fixes as best as we can for now. Include latest relevant doc changes from: - v8.1.0815 - v8.2.2658
* vim-patch:8.2.2712: memory leak when adding to a blob failsSean Dewar2021-09-16
| | | | | | Problem: Memory leak when adding to a blob fails. Solution: Clear the second typval before returning. https://github.com/vim/vim/commit/f2dd9cb9958962302d33fab8fe6439645a2d1e1b
* vim-patch:8.2.1473: items in a list given to :const can still be modifiedSean Dewar2021-09-16
| | | | | | | Problem: Items in a list given to :const can still be modified. Solution: Work like ":lockvar! name" but don't lock referenced items. Make locking a blob work. https://github.com/vim/vim/commit/021bda56710d98c09a6b35610a476ab2dd8c58ad
* vim-patch:8.2.0829: filter() may give misleading error messageSean Dewar2021-09-15
| | | | | | | | | Problem: filter() may give misleading error message. Solution: Also mention Blob as an allowed argument. https://github.com/vim/vim/commit/fcb0b61d15f66f0e9116a6bc56d9d8105bb913cf Rename Test_map_fails() to Test_map_filter_fails() from v8.2.0610 and include the modeline.
* vim-patch:8.2.0121: filter() and map() on blob don't workSean Dewar2021-09-15
| | | | | | Problem: filter() and map() on blob don't work. Solution: Correct the code. (closes vim/vim#5483) https://github.com/vim/vim/commit/49c57ce50019b667e5005ce1cfb8cdc2e48bf868
* vim-patch:8.1.1023: may use NULL pointer when indexing a blobSean Dewar2021-09-15
| | | | | | Problem: May use NULL pointer when indexing a blob. (Coverity) Solution: Break out of loop after using index on blob https://github.com/vim/vim/commit/61be376337b0374d55a4b1d8206b2ec87ca54252
* vim-patch:8.1.0802: negative index doesn't work for BlobSean Dewar2021-09-15
| | | | | | | | Problem: Negative index doesn't work for Blob. Solution: Make it work, add a test. (closes vim/vim#3856) https://github.com/vim/vim/commit/a5be9b62480a6f338a72c01e57c9edd0bca8048b Leave tv_blob_get()'s return type untouched.
* vim-patch:8.1.0798: changing a blob while iterating over it works strangelySean Dewar2021-09-15
| | | | | | Problem: Changing a blob while iterating over it works strangely. Solution: Make a copy of the Blob before iterating. https://github.com/vim/vim/commit/dd29ea18050284526174b5685781469240f5bc4a
* vim-patch:8.1.0765: string format of a Blob can't be parsed backSean Dewar2021-09-15
| | | | | | Problem: String format of a Blob can't be parsed back. Solution: Use 0z format. https://github.com/vim/vim/commit/4131fd5509b283e978e8c6161f09643b64719787
* vim-patch:8.1.0756: copy() does not make a copy of a BlobSean Dewar2021-09-15
| | | | | | | | Problem: copy() does not make a copy of a Blob. Solution: Make a copy. https://github.com/vim/vim/commit/3d28b58c519c9fc3427587201423c74746cc219e Replace vim_memsave() with xmemdup().
* vim-patch:8.1.0738: using freed memory, for loop over blob leaks memorySean Dewar2021-09-15
| | | | | | | Problem: Using freed memory, for loop over blob leaks memory. Solution: Clear pointer after freeing memory. Decrement reference count after for loop over blob. https://github.com/vim/vim/commit/ecc8bc482ba601b9301a6c129c92a0d1f8527f72
* vim-patch:8.1.0736: code for Blob not sufficiently testedSean Dewar2021-09-15
| | | | | | | | | Problem: Code for Blob not sufficiently tested. Solution: Add more tests. Fix uncovered crash. Add test_null_blob(). https://github.com/vim/vim/commit/c0f5a78c15b194f23bedb82e6825e34f481e6532 eval0 and ex_echo's emsg-specific changes have already been ported. These tests uncover another crash that was fixed in v8.1.0738.
* vim-patch:8.1.0735: cannot handle binary dataSean Dewar2021-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Cannot handle binary data. Solution: Add the Blob type. (Yasuhiro Matsumoto, closes vim/vim#3638) https://github.com/vim/vim/commit/6e5ea8d2a995b32bbc5972edc4f827b959f2702f Nvim-specific Blob conversions are implemented in future commits. Refactor write_blob() to use a FileDescriptor, as f_writefile() was refactored to use one (does not apply to read_blob()). Use var_check_lock() in f_add() for Blobs from v8.1.0897. Add a modeline to test_blob.vim and fix some doc typos. Include if_perl.txt's VIM::Blob() documentation. Interestingly, this function already worked before this port, as it just returns a Blob string literal, not an actual Blob object. N/A patches for version.c: vim-patch:8.1.0741: viminfo with Blob is not tested Problem: Viminfo with Blob is not tested. Solution: Extend the viminfo test. Fix reading a blob. Fixed storing a special variable value. https://github.com/vim/vim/commit/8c8b8bb56c724cc1bfc3d8520eec33f2d399697c vim-patch:8.1.1022: may use NULL pointer when out of memory Problem: May use NULL pointer when out of memory. (Coverity) Solution: Check for blob_alloc() returning NULL. https://github.com/vim/vim/commit/e142a9467a7f6845a426d8db6efedf246d3c13ac
* vim-patch:8.1.1722: error when scriptversion is 2 a making a dictionary accessSean Dewar2021-09-11
| | | | | | | | | Problem: Error when scriptversion is 2 a making a dictionary access. Solution: Parse the subscript even when not evaluating the sub-expression. (closes vim/vim#4704) https://github.com/vim/vim/commit/61343f0c44c8e71df04918d033e0a744c0b7f8aa :scriptversion is N/A.
* vim-patch:8.1.1355: obvious mistakes are accepted as valid expressionsSean Dewar2021-09-11
| | | | | | | | | Problem: Obvious mistakes are accepted as valid expressions. Solution: Be more strict about parsing numbers. (Yasuhiro Matsumoto, closes vim/vim#3981) https://github.com/vim/vim/commit/16e9b85113e0b354ece1cb4f5fcc7866850f3685 Update vim_str2nr_spec.lua to add more tests that use strict = true.
* Merge #15293 Vimscript "method" syntaxJustin M. Keyes2021-08-26
|\ | | | | Port VimL's method call syntax - vim-patch:8.1.{1638,1800,1803,1807,1809,1816,1820,1821,1828,1834,1835,1861,1863,1878,1879,1888,1909,1911,1912}
| * feat(v:lua): support calling v:lua as a methodSean Dewar2021-08-13
| |
| * fix(eval_lambda): cherry-pick leak fix from v8.1.2107Sean Dewar2021-08-12
| | | | | | | | | | That patch also includes a test using test_refcount() for lambdas, but such test functions are N/A for Nvim.
| * vim-patch:8.1.1878: negative float before method not parsed correctlySean Dewar2021-08-12
| | | | | | | | | | | | Problem: Negative float before method not parsed correctly. Solution: Apply "!" and "-" in front of expression before using ->. https://github.com/vim/vim/commit/9cfe8f6e68de4bfb5942d84f4465de914a747b3f
| * vim-patch:8.1.1834: cannot use a lambda as a methodSean Dewar2021-08-12
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Cannot use a lambda as a method. Solution: Implement ->{lambda}(). (closes vim/vim#4768) https://github.com/vim/vim/commit/22a0c0c4ecd23b6c43f79ba9b92899ca0b426e29 Add an additional lua_funcname argument to call_func_rettv() to maintain support for v:lua. A memory leak was introduced with this patch that was fixed in v8.1.2107.
| * vim-patch:8.1.1828: not strict enough checking syntax of method invocationSean Dewar2021-08-12
| | | | | | | | | | | | Problem: Not strict enough checking syntax of method invocation. Solution: Check there is no white space inside ->method(. https://github.com/vim/vim/commit/5184132ec015f5889a3195d911e609d214f06bed
| * vim-patch:8.1.1820: using expr->FuncRef() does not workSean Dewar2021-08-12
| | | | | | | | | | | | Problem: Using expr->FuncRef() does not work. Solution: Make FuncRef work as a method. https://github.com/vim/vim/commit/761fdf01c6e307c448cec2684f8b315ba6d1f454
| * vim-patch:8.1.1816: cannot use a user defined function as a methodSean Dewar2021-08-12
| | | | | | | | | | | | | | Problem: Cannot use a user defined function as a method. Solution: Pass the base as the first argument to the user defined function after "->". (partly by FUJIWARA Takuya) https://github.com/vim/vim/commit/fcfe1a9b8950b8b211ab3b24d84b17c6847ea43f