aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/funcs.c
Commit message (Collapse)AuthorAge
...
* | vim-patch:8.2.4559: getmousepos() returns the screen columnSean Dewar2022-03-15
| | | | | | | | | | | | | | | | | | Problem: getmousepos() returns the screen column. (Ernie Rael) Solution: Return the text column, as documented. https://github.com/vim/vim/commit/533870a98501fac2b51ef4bc489fac3a055a41a9 Re-introduce vcol2col, which was removed in 71b1f4e for being unused. Move it to mouse.c (like in v8.1.2062, which hasn't been ported yet).
* | vim-patch:8.2.4555: getmousepos() returns the wrong columnSean Dewar2022-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: getmousepos() returns the wrong column. (Ernie Rael) Solution: Limit to the text size, not the number of bytes. https://github.com/vim/vim/commit/986b0fd0c550d9834a3cc45dd87555c13152c391 test_setmouse is N/A; adjust test for Nvim. N/A patches for version.c: vim-patch:8.2.4569: Coverity warning for not using a return value Problem: Coverity warning for not using a return value. Solution: Add "(void)". https://github.com/vim/vim/commit/977525fea662b7f37ad0e052894c1f62b5b03269
* | vim-patch:8.2.1401: cannot jump to the last used tabpageSean Dewar2022-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Cannot jump to the last used tabpage. Solution: Add g<Tab> and tabpagnr('#'). (Yegappan Lakshmanan, closes vim/vim#6661, neovim #11626) https://github.com/vim/vim/commit/62a232506d06f6d1b3b7271801c907d6294dfe84 Nvim implemented this feature before Vim, but Vim made some useful changes (e.g: beeping on failure). Port the changes to closer match Vim (also makes porting future patches easier). Also note that because CHECK_CMDWIN was added to goto_tabpage_tp, there is no need to do the extra work with tabpage_index and goto_tabpage inside goto_tabpage_lastused to fix cmdwin issues any more (#11692). Note that while goto_tabpage_tp doesn't check for textlock like goto_tabpage does, it shouldn't matter as it is already checked for earlier. Add tags for <C-Tab> to tabpage.txt, and refer to <C-Tab> over CTRL-Tab to be consistent with other docs like the patch. Remove mention of "previous tabpage" (it can be confused with the tabpage to the left, e.g: `:tabprevious`). Similarly, don't rename old_curtab to last_tab in enter_tabpage (it might be confused with the right-most tabpage, e.g: `:tablast`). Cherry-pick Test_tabpage change from v8.2.0634. https://github.com/vim/vim/commit/92b83ccfda7a1d654ccaaf161a9c8a8e01fbcf76
* | refactor(eval/funcs): convert function comments to doxygen formatDundar Göc2022-03-14
| |
* | vim-patch:8.1.0892: failure when closing a window when location list is in useVVKot2022-03-13
| | | | | | | | | | | | | | | | Problem: Failure when closing a window when location list is in use. Solution: Handle the situation gracefully. Make sure memory for 'switchbuf' is not freed at the wrong time. (Yegappan Lakshmanan, closes vim/vim#3928) https://github.com/vim/vim/commit/eeb1b9c7ed33c152e041a286d79bf3ed00d80e40
* | refactor(uncrustify): disable uncrustify for misformatted code sectionsDundar Göc2022-03-10
| | | | | | | | | | Uncrustify version 0.74 has a bug that deindents and misformats the entire fileio.c.
* | chore(lgtm): fix "empty block without comment" warningsDundar Göc2022-03-09
| |
* | Merge pull request #17622 from ↵zeertzjq2022-03-09
|\ \ | | | | | | | | | | | | dundargoc/refactor/clang-tidy/remove-redundant-casts refactor/clang tidy/remove redundant casts
| * | refactor: remove redundant castsDundar Göc2022-03-06
| | |
* | | fix(api): highlight attribute for underlineKirill Chibisov2022-03-06
|/ / | | | | | | | | | | | | This commit fixes regression introduced in c365de1 when checking for highlight attribute for underline was returning '0' when it was present Fixes #17624.
* | Merge pull request #17589 from kchibisov/add-dashed-dotted-underlineJames McCoy2022-03-05
|\ \ | | | | | | Add support for double, dashed, and dotted underlines
| * | fix: bounds check for underdotKirill Chibisov2022-03-05
| | |
| * | feat(tui): add support for `CSI 4 : [2,4,5] m`Kirill Chibisov2022-03-03
| | | | | | | | | | | | | | | | | | | | | | | | This commit finishes support for colored and styled underlines adding `CSI 4 : [2,4,5] m` support providing double, dashed, and dotted underlines Fixes #17362.
* | | refactor: fix clang-tidy bugprone-signed-char-misuse warningsDundar Göc2022-03-04
|/ / | | | | | | | | Prefer to declare variables with correct type instead of explicit casts wherever possible.
* | feat(lua): add api and lua autocmdsTJ DeVries2022-02-27
| |
* | refactor(aucmd_win): remove need to restore window layoutSean Dewar2022-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There are some places that mess with the window layout in preparation for moving a window to a different split (win_split_ins called with new_wp != NULL). This means the window layout can change slightly even if win_split_ins fails. This is why it was still needed to restore the window layout in aucmd_{prep,rest}buf even if we disallow win_split_ins from making aucmd_win non-floating by moving it into a split. We can just skip messing with the layout in such places if we're dealing with the aucmd_win.
* | vim-patch:8.2.4427: getchar() may return modifiers if no character is availablezeertzjq2022-02-21
|/ | | | | | Problem: getchar() may return modifiers if no character is available. Solution: Do not process modifiers when there is no character. (closes vim/vim#9806) https://github.com/vim/vim/commit/ad6c45f62558e03d3e3a927b3fe4dbaf30a36bef
* vim-patch:8.2.3510: changes are only detected with one second accuracyzeertzjq2022-02-13
| | | | | | | | | Problem: Changes are only detected with one second accuracy. Solution: Use the nanosecond time if possible. (Leah Neukirchen, closes vim/vim#8873, closes vim/vim#8875) https://github.com/vim/vim/commit/0a7984af5601323fae7b3398f05a48087db7b767 In Nvim Test_checktime_fast() is also flaky. Add a delay to avoid that.
* vim-patch:8.2.2342: "char" functions may return wrong column in Insert modezeertzjq2022-02-12
| | | | | | | Problem: "char" functions return the wront column in Insert mode when the cursor is beyond the end of the line. Solution: Compute the column correctly. (Yegappan Lakshmanan, closes vim/vim#7669) https://github.com/vim/vim/commit/9145846b6aa411e3ab5c0d145b37808654352877
* vim-patch:8.2.0918: duplicate code for evaluating expression argumentSean Dewar2022-02-12
| | | | | | Problem: Duplicate code for evaluating expression argument. Solution: Merge the code and make the use more flexible. https://github.com/vim/vim/commit/a9c010494767e43a51c443cac35ebc80d0831d0b
* vim-patch:8.2.0915: search() cannot skip over matches like searchpair() canSean Dewar2022-02-12
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Search() cannot skip over matches like searchpair() can. Solution: Add an optional "skip" argument. (Christian Brabandt, closes vim/vim#861) https://github.com/vim/vim/commit/adc17a5f9d207fd1623fd923457a46efc9214777 Enable skip arg usage in autoload/freebasic.vim evalarg_T doesn't really matter because it's deleted in v8.2.0918 (and reincarnated for Vim9 script in v8.2.1047), but I found out too late :P Anyway: - Port evalarg_T into eval.h and use const char * and Callback fields - Use EVALARG_INIT to initialize - Return bool over OK/FAIL from evalarg functions - Remove check from evalarg_clean as callback_free ignores None callbacks anyway - Move eva_buf field into evalarg_get as a local (not sure what reason it has being in the struct) N/A patches for version.c: vim-patch:8.2.4355: unnecessary call to check_colorcolumn() Problem: Unnecessary call to check_colorcolumn(). Solution: Remove the call. (Sean Dewar, closes vim/vim#9748) https://github.com/vim/vim/commit/0f7ff851cb721bb3c07261adbf82b591229f530d
* Merge pull request #16553 from seandewar/vim-8.2.0878Sean Dewar2022-02-08
|\ | | | | vim-patch:8.2.{0882,1051,1083}: port `reduce()` function
| * vim-patch:8.2.1083: crash when using reduce() on a NULL listSean Dewar2022-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Crash when using reduce() on a NULL list. Solution: Only access the list when not NULL. https://github.com/vim/vim/commit/fda20c4cc59008264676a6deb6a3095ed0c248e0 CHECK_LIST_MATERIALIZE hasn't been ported yet, but presumably if it is ported it'll use tv_list_first to check for range_list_item, which already checks for NULL, so this should need no extra changes and can be a full port. We didn't actually crash here due to the use of Nvim's tv_list functions checking for NULL, but apply these changes to match Vim better anyway.
| * vim-patch:8.2.1051: crash when changing a list while using reduce() on itSean Dewar2022-01-31
| | | | | | | | | | | | Problem: Crash when changing a list while using reduce() on it. Solution: Lock the list. (closes vim/vim#6330) https://github.com/vim/vim/commit/ca275a05d8b79f6a9101604fdede2373d0dea44e
| * vim-patch:8.2.0882: leaking memory when using reduce()Sean Dewar2022-01-31
| | | | | | | | | | | | Problem: Leaking memory when using reduce(). Solution: Free the intermediate value. https://github.com/vim/vim/commit/48b1c21809553d3463b5ed6c2b3bc6d335663bb6
| * feat(eval): partially port v8.2.0878Sean Dewar2022-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: No reduce() function. Solution: Add a reduce() function. (closes vim/vim#5481) https://github.com/vim/vim/commit/85629985b71035608a37ba3bde86968481490d46 Needs CHECK_LIST_MATERIALIZE from v8.2.0751 (and range_list_materialize from 8.2.0149). Move e_reduceempty to funcs.c, as it's only used there. Make it static. Use tv_blob_len, tv_list_len == 0 for empty checks. Replace vim_memset(&funcexe, 0, ...) with FUNCEXE_INIT. Leave li initially undefined (tv_list_first returns NULL if list is NULL). This patch has a memory leak fixed by v8.2.0882.
* | vim-patch:8.2.1726: fuzzy matching only works on stringsSean Dewar2022-02-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Fuzzy matching only works on strings. Solution: Support passing a dict. Add matchfuzzypos() to also get the match positions. (Yegappan Lakshmanan, closes vim/vim#6947) https://github.com/vim/vim/commit/4f73b8e9cc83f647b34002554a8bdf9abec0a82f Also remove some N/A and seemingly useless NULL checks -- Nvim allocs can't return NULL. I'm not sure why the retmatchpos stuff in match_fuzzy checks for NULL too, given that Vim checks for NULL alloc in do_fuzzymatch; assert that the li stuff is not NULL as that's the one check I'm ever-so-slightly unsure about. Adjust tests. Note that the text_cb tests actually throw E6000 in Nvim, but we also can't assert that error due to v8.2.1183 not being ported yet.
* | Merge pull request #17305 from zeertzjq/vim-8.2.1741zeertzjq2022-02-07
|\ \ | | | | | | vim-patch:8.2.1741: pathshorten() only supports using one character
| * | vim-patch:8.2.1741: pathshorten() only supports using one characterzeertzjq2022-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: pathshorten() only supports using one character. Solution: Add an argument to control the length. (closes vim/vim#7006) https://github.com/vim/vim/commit/6a33ef0deb5c75c003a9f3bd1c57f3ca5e77327e Cherry-pick a line in test from patch 8.2.0634. Use Nvim's config paths in docs. shorten_dir() returning a pointer looks a bit confusing here, as it is actually the same pointer passed to it, and it doesn't really reduce much code, so change it back to void. Assigning rettv->vval.v_string = NULL is not needed if a pointer is within 64 bits. While this is usually the case, I'm not sure if it can be taken for granted.
* | | Merge pull request #17279 from zeertzjq/state-enter-vpeekcbfredl2022-02-06
|\ \ \ | |/ / |/| | fix(event-loop): call vpeekc() directly first to check for character
| * | fix(event-loop): call vpeekc() directly first to check for characterzeertzjq2022-02-03
| |/ | | | | | | Expand mappings first by calling `vpeekc()` directly.
* | vim-patch:8.2.2363: curpos() does not accept a string argument as beforezeertzjq2022-02-06
| | | | | | | | | | | | | | Problem: curpos() does not accept a string argument as before. solution: Make a string argument work again. (Yegappan Lakshmanan, closes vim/vim#7690 https://github.com/vim/vim/commit/9ebcf231bdccc1673cc92b20f5190fc577ad29d0
* | vim-patch:8.2.2324: not easy to get mark en cursor posotion by character countzeertzjq2022-02-06
| | | | | | | | | | | | | | Problem: Not easy to get mark en cursor posotion by character count. Solution: Add functions that use character index. (Yegappan Lakshmanan, closes vim/vim#7648) https://github.com/vim/vim/commit/6f02b00bb0958f70bc15534e115b4c6dadff0e06
* | vim-patch:8.2.1727: a popup created with "cursorline" will ignore "firstline"zeertzjq2022-02-06
| | | | | | | | | | | | | | | | | | | | | | Problem: A popup created with "cursorline" will ignore "firstline". Solution: When both "cursorline" and "firstline" are present put the cursor on "firstline". (closes vim/vim#7000) Add the "winid" argument to getcurpos(). https://github.com/vim/vim/commit/99ca9c4868bb1669706b9e3de9a9218bd11cc459 Skip popup window related code. Cherry-pick all of Test_getcurpos_setpos() from patch 8.2.0610.
* | vim-patch:8.2.0233: crash when using garbagecollect() in between rand()Sean Dewar2022-02-05
| | | | | | | | | | | | | | | | | | | | | | Problem: Crash when using garbagecollect() in between rand(). Solution: Redesign the rand() and srand() implementation. (Yasuhiro Matsumoto, closes vim/vim#5587, closes vim/vim#5588) https://github.com/vim/vim/commit/4f645c54efe33d7a11e314676e503118761f08a7 Omit test_srand_seed. Unmacroify SHUFFLE_XOSHIRO128STARSTAR and SPLITMIX32 while we're at it (leave ROTL alone as it's fairly innocent).
* | vim-patch:8.1.2356: rand() does not use the best algorithmSean Dewar2022-02-05
| | | | | | | | | | | | | | Problem: rand() does not use the best algorithm. Solution: use xoshiro128** instead of xorshift. (Kaito Udagawa, closes vim/vim#5279) https://github.com/vim/vim/commit/f8c1f9200c4b50969a8191a4fe0b0d09edb38979
* | vim-patch:8.1.2343: using time() for srand() is not very randomSean Dewar2022-02-05
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Using time() for srand() is not very random. Solution: use /dev/urandom if available https://github.com/vim/vim/commit/07e4a197953d12902fb97beb48830a5323a52280 Use os_open and os_close. time_settime is N/A, so some parts of the test are disabled. There's maybe a very, very, very, very small chance the /dev/urandom test fails, but it shouldn't matter. :P
* | vim-patch:8.1.2342: random number generator in Vim script is slowSean Dewar2022-02-05
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Random number generator in Vim script is slow. Solution: Add rand() and srand(). (Yasuhiro Matsumoto, closes vim/vim#1277) https://github.com/vim/vim/commit/06b0b4bc27077013e9b4b48fd1d9b33e543ccf99 Add missing method call usage to builtin.txt. vim_time and test_settime is N/A. Add a modeline to test_random.vim. Use typval_T* over listitem_T* vars so we don't need to use TV_LIST_ITEM_TV all over the place... Remove NULL list checks (tv_list_len covers this).
* | Merge pull request #17272 from zeertzjq/vim-8.1.0846zeertzjq2022-02-04
|\ \ | | | | | | vim-patch:8.1.{0846,0878,0884,2358},8.2.{0305,0352,0687,3797}
| * | vim-patch:8.1.0846: not easy to recognize the system Vim runs onzeertzjq2022-02-04
| |/ | | | | | | | | | | | | | | | | Problem: Not easy to recognize the system Vim runs on. Solution: Add more items to the features list. (Ozaki Kiichi, closes vim/vim#3855) https://github.com/vim/vim/commit/39536dd557e847e80572044c2be319db5886abe3 Some doc changes have already been applied. Some others are N/A. "moon" was removed in patch 8.2.0427 so I did not add it.
* | fix(api/nvim_win_call): share common win_execute logicSean Dewar2022-02-03
| | | | | | | | | | | | | | | | | | | | We have to be sure that the bugs fixed in the previous patches also apply to nvim_win_call. Checking v8.1.2124 and v8.2.4026 is especially important as these patches were only applied to win_execute, but nvim_win_call is also affected by the same bugs. A lot of win_execute's logic can be shared with nvim_win_call, so factor it out into a common macro to reduce the possibility of this happening again.
* | vim-patch:8.2.4026: ml_get error with specific win_execute() commandSean Dewar2022-02-03
| | | | | | | | | | | | Problem: ml_get error with specific win_execute() command. (Sean Dewar) Solution: Check cursor and Visual area are OK. https://github.com/vim/vim/commit/e664a327014f4aa8baf8549a34a4caab2f3116a3
* | vim-patch:8.2.4018: ml_get error when win_execute redraws with Visual selectionSean Dewar2022-02-03
|/ | | | | | | | | | | Problem: ml_get error when win_execute redraws with Visual selection. Solution: Disable Visual area temporarily. (closes vim/vim#9479) https://github.com/vim/vim/commit/18f4740f043b353abe47b7a00131317052457686 {switch_to/restore}_win_for_buf is N/A (marked as such in v8.0.0860; currently only used in Vim's if_py). Add a modeline to test_execute_func.vim.
* feat(provider)!: remove support for python2 and python3.[3-5]Björn Linse2022-01-29
| | | | | | These versions of python has reached End-of-life. getting rid of python2 support removes a lot of logic to support two incompatible python versions in the same version.
* vim-patch:8.2.4052: not easy to resize a window from a plugin (#17028)Daniel Steinberg2022-01-29
|
* refactor: add `static` to some functions in `funcs.c` (#17030)Daniel Steinberg2022-01-29
|
* Merge pull request #15910 from glacambre/silent_stdioopenbfredl2022-01-24
|\ | | | | feat(--headless): do not print anything when stdioopen() has been used
| * feat(--headless): add on_print callback to stdioopenglacambre2022-01-24
| | | | | | | | | | | | | | This commit adds an on_print callback to stdioopen's dictionary argument which lets the caller specify a function called each time neovim will try to output something to stdout (e.g. on "echo" or "echoerr" in --headless mode).
* | vim-patch:8.2.3956: duplicate assignmentDundar Göc2022-01-01
| | | | | | | | | | | | Problem: Duplicate assignment. Solution: Remove the second assignment. (closes vim/vim#9442) https://github.com/vim/vim/commit/4b1478093eb8b8bebc94b1f596e0afc25db4d189
* | 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`.