aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/funcs.c
Commit message (Collapse)AuthorAge
* vim-patch:8.2.4402: missing parenthesis may cause unexpected problemsBrian Leung2022-04-03
| | | | | | Problem: Missing parenthesis may cause unexpected problems. Solution: Add more parenthesis is macros. https://github.com/vim/vim/commit/ae6f1d8b14c2f63811ee83ef14e32086fb3e9b83
* [RFC] vim-patch:8.1.1378: delete() can not handle a file name that looks ↵Shougo2022-04-03
| | | | | | | | | | | | li… (#16268) Problem: Delete() can not handle a file name that looks like a pattern. Solution: Use readdir() instead of appending "/*" and expanding wildcards. (Ken Takata, closes vim/vim#4424, closes vim/vim#696) https://github.com/vim/vim/commit/701ff0a3e53d253d7300c385e582659bbff7860d Cherry-pick a change to Test_delete_rf() from patch 8.1.1921. Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* vim-patch:8.1.1687: the evalfunc.c file is too big (#17949)Lewis Russell2022-04-03
| | | | | Problem: The evalfunc.c file is too big. Solution: Move testing support to a separate file. https://github.com/vim/vim/commit/ecaa70ea29c269dd0dabd3cd5acdfa0ce42ccd54
* vim-patch:8.2.3449: sort fails if the sort compare function returns 999 (#17909)dundargoc2022-03-30
| | | | | Problem: Sort fails if the sort compare function returns 999. Solution: Adjust value to -1 / 0 / 1. (Yasuhiro Matsumoto, closes vim/vim#8884) https://github.com/vim/vim/commit/c04f62346bfd6b92151908239a3c5ab1a7d18f2a
* vim-patch:8.2.1078: highlight and match functionality together in one file ↵Lewis Russell2022-03-23
| | | | | | | | | (#17805) Problem: Highlight and match functionality together in one file. Solution: Move match functionality to a separate file. (Yegappan Lakshmanan, closes vim/vim#6352) https://github.com/vim/vim/commit/06cf97e714fd8bf9b35ff5f8a6f2302c79acdd03
* vim-patch:8.1.1608: the evalfunc.c file is too big (#17807)Lewis Russell2022-03-23
| | | | | | Problem: The evalfunc.c file is too big. Solution: Move sign functionality to sign.c. https://github.com/vim/vim/commit/b60d8514b8813e2f3acefd454efcccbe04ac135a
* vim-patch:8.1.1742: still some match functions in evalfunc.cLewis Russell2022-03-20
| | | | | | | Problem: Still some match functions in evalfunc.c. Solution: Move them to highlight.c. https://github.com/vim/vim/commit/7dfb016d25e3e3e1f4411026dda21d1536f21acc
* vim-patch:8.1.1734: the evalfunc.c file is too bigLewis Russell2022-03-20
| | | | | | | Problem: The evalfunc.c file is too big. Solution: Move some functions to other files. https://github.com/vim/vim/commit/29b7d7a9aac591f920edb89241c8cde27378e50b
* vim-patch:8.1.1693: syntax coloring and highlighting is in one big file (#17721)Lewis Russell2022-03-18
| | | | | | | | | | | Problem: Syntax coloring and highlighting is in one big file. Solution: Move the highlighting to a separate file. (Yegappan Lakshmanan, closes vim/vim#4674) https://github.com/vim/vim/commit/f9cc9f209ede9f15959e4c2351e970477c139614 Name the new file highlight_group.c instead. Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* Merge pull request #17266 from famiu/feat/ui/global-statuslinebfredl2022-03-17
|\ | | | | feat(statusline): add global statusline
| * feat: add support for global statuslineFamiu Haque2022-03-18
| | | | | | | | | | | | | | | | | | | | Ref: #9342 Adds the option to have a single global statusline for the current window at the bottom of the screen instead of a statusline at the bottom of every window. Enabled by setting `laststatus = 3`. Due to the fact that statuslines at the bottom of windows are removed when global statusline is enabled, horizontal separators are used instead to separate horizontal splits. The horizontal separator character is configurable through the`horiz` item in `'fillchars'`. Separator connector characters are also used to connect the horizontal and vertical separators together, which are also configurable through the `horizup`, `horizdown`, `vertleft`, `vertright` and `verthoriz` items in `fillchars`. The window separators are highlighted using the `WinSeparator` highlight group, which supersedes `VertSplit` and is linked to `VertSplit` by default in order to maintain backwards compatibility.
* | chore: fix typos (#17670)dundargoc2022-03-17
| | | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* | vim-patch:8.2.4568: getmousepos() does not compute the column below the last ↵Sean Dewar2022-03-15
| | | | | | | | | | | | | | | | | | | | | | line Problem: getmousepos() does not compute the column below the last line. Solution: Also compute the column when the mouse is below the last line. (Sean Dewar, closes vim/vim#9946) https://github.com/vim/vim/commit/10792feebd237aee89270669e509e85cafdfac60 test_setmouse is N/A.
* | 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