aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
| * | vim-patch:9.0.2124: INT overflow detection logic can be simplifiedzeertzjq2024-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: INT overflow logic can be simplified Solution: introduce trim_to_int() function closes: vim/vim#13556 https://github.com/vim/vim/commit/2b0882fa6555b4d0197afbdfc32a4533cf6aacf4 vim-patch:9.0.2138: Overflow logic requires long long Problem: Overflow logic requires long long Solution: Define vimlong_T data type to make life easier for porters closes: vim/vim#13598 https://github.com/vim/vim/commit/fda700cb04612fe2f9301a9ba820309175decabf Cherry-pick ops.c change from patch 9.1.0608. Co-authored-by: Ernie Rael <errael@raelity.com>
| * | vim-patch:9.0.2122: [security]: prevent overflow in indentingzeertzjq2024-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: [security]: prevent overflow in indenting Solution: use long long and remove cast to (int) The shiftwidth option values are defined as being long. However, when calculating the actual amount of indent, we cast down to (int), which may cause the shiftwidth value to become negative and later it may even cause Vim to try to allocate a huge amount of memory. We already use long and long long variable types to calculate the indent (and detect possible overflows), so the cast to (int) seems superfluous and can be safely removed. So let's just remove the (int) cast and calculate the indent using longs. Additionally, the 'shiftwidth' option value is also used when determining the actual 'cino' options. There it can again cause another overflow, so make sure it is safe in parse_cino() as well. fixes: vim/vim#13554 closes: vim/vim#13555 https://github.com/vim/vim/commit/3770574e4a70e810add9929973c51f9070c8c851 Co-authored-by: Christian Brabandt <cb@256bit.org>
| * | vim-patch:9.0.2113: Coverity warns for another overflow in shift_line()zeertzjq2024-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Coverity warns for another overflow in shift_line() Solution: Test for INT_MAX after the if condition, cast integer values to (long long) before multiplying. https://github.com/vim/vim/commit/22a97fc241361aa91bda84e5344d5b7c0cda3e81 Co-authored-by: Christian Brabandt <cb@256bit.org>
| * | vim-patch:9.0.2112: [security]: overflow in shift_linezeertzjq2024-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: [security]: overflow in shift_line Solution: allow a max indent of INT_MAX [security]: overflow in shift_line When shifting lines in operator pending mode and using a very large value, we may overflow the size of integer. Fix this by using a long variable, testing if the result would be larger than INT_MAX and if so, indent by INT_MAX value. Special case: We cannot use long here, since on 32bit architectures (or on Windows?), it typically cannot take larger values than a plain int, so we have to use long long count, decide whether the resulting multiplication of the shiftwidth value * amount is larger than INT_MAX and if so, we will store INT_MAX as possible larges value in the long long count variable. Then we can safely cast it back to int when calling the functions to set the indent (set_indent() or change_indent()). So this should be safe. Add a test that when using a huge value in operator pending mode for shifting, we will shift by INT_MAX closes: vim/vim#13535 https://github.com/vim/vim/commit/6bf131888a3d1de62bbfa8a7ea03c0ddccfd496e Skip the test for now, as it takes too long and requires other fixes. Co-authored-by: Christian Brabandt <cb@256bit.org>
| * | docs(vvars): adjust lua types for vim.v variables #31510luukvbaal2024-12-09
| | | | | | | | | | | | - classes for v:event and v:completed_item - add remaining unknown types
| * | build: mark CMake variables advanced #31412Eisuke Kawashima2024-12-09
| | | | | | | | | The variables are not marked as advanced, thus they appear in e.g. `ccmake`.
| * | vim-patch:9.1.0913: no error check for neg values for 'messagesopt' (#31511)zeertzjq2024-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: no error check for neg values for 'messagesopt' (after v9.1.0908) Solution: add additional error checks and tests (h-east) closes: vim/vim#16187 https://github.com/vim/vim/commit/65be834c30fb43abb2e41585b41eefcd2ae06c01 Nvim's getdigits() checks for overflow, so the code change isn't needed. Co-authored-by: h-east <h.east.727@gmail.com>
| * | fix(lua): avoid vim._with() double-free with cmdmod (#31505)zeertzjq2024-12-08
| | |
| * | vim-patch:336fb22: translation(vi): Update Vietnamese translationbrianhuster2024-12-08
| | | | | | | | | | | | | | | | | | closes: vim/vim#16144 https://github.com/vim/vim/commit/336fb22eaef7977741712d0c4735fc6d65428a4f
| * | vim-patch:9.1.0911: Variable name for 'messagesopt' doesn't match short namezeertzjq2024-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Variable name for 'messagesopt' doesn't match short name (after v9.1.0908) Solution: Change p_meo to p_mopt. Add more details to docs. closes: vim/vim#16182 https://github.com/vim/vim/commit/8cc43daee1f485c9abf1de3c638cce7835b9f861
| * | vim-patch:9.1.0910: 'messagesopt' does not check max wait timezeertzjq2024-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 'messagesopt' does not check max wait time (after v9.1.0908) Solution: Check for max wait value (Shougo Matsushita) closes: vim/vim#16183 https://github.com/vim/vim/commit/d9e9f89e0ffd6e7ce5e2a7f8f1ace5471e37c210 Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
| * | feat(ex_cmds): :sleep! hides the cursor while sleeping (#31493)zeertzjq2024-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: :sleep! not hiding the cursor is an arbitrary difference from Vim without obvious justification, and Vim's behavior isn't easily achievable in Nvim. Solution: Make :sleep! hide the cursor while sleeping. Ref: https://github.com/neovim/neovim/commit/6a01b3fcc361960e559db459e1524418bc76dd66 https://github.com/neovim/neovim/commit/b5c0ade43790cf18f6a54858ddad30d8d9667cf9
| * | Merge pull request #31475 from luukvbaal/delgravitybfredl2024-12-07
| |\ \ | | | | | | | | fix(marks): check gravity at range bounds when deleting text
| | * | fix(marks): skip right_gravity marks when deleting textLuuk van Baal2024-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Marks that are properly restored by the splice associated with an undo edit, are unnecessarily pushed to the undo header. This results in incorrect mark tracking in the "copy_only" save/restore completion path. Solution: Avoid pushing left gravity marks at the beginning of the range, and right gravity marks at the end of the range to the undo header.
| * | | vim-patch:9.1.0908: not possible to configure :messages (#31492)zeertzjq2024-12-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: not possible to configure :messages Solution: add the 'messagesopt' option (Shougo Matsushita) closes: vim/vim#16068 https://github.com/vim/vim/commit/51d4d84d6a7159c6ce9e04b36f8edc105ca3794b Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com> Co-authored-by: h_east <h.east.727@gmail.com>
| * | | feat(stdlib): vim.json.encode(...,{escape_slash:boolean}) #30561Bartłomiej Maryńczak2024-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: vim.json.encode escapes every slash in string values (for example in file paths), and is not optional. Use-case is for preventing HTML injections (eg. injecting `</script>` closing tag); in the context of Nvim this is rarely useful. Solution: - Add a `escape_slash` flag to `vim.json.encode`. - Defaults to `false`. (This is a "breaking" change, but more like a bug fix.)
| * | | fix(completion): avoid deleting text when completion leader changes #31448luukvbaal2024-12-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: When completion leader changes, text that might be reinserted immediately after is deleted. This unnecessarily affects extmarks. #31387 restored the original extmarks but that prevents end_right_gravity marks from growing. Solution: Avoid deleting leader text that will be reinserted.
| * | | fix(events): don't expand `args.file` for Lua callback (#31473)zeertzjq2024-12-06
| |/ / | | | | | | | | | | | | | | | | | | | | | Problem: In an autocommand Lua callback whether `args.file` is expanded depends on whether `expand('<afile>')` has been called. Solution: Always use the unexpanded file name for `args.file`. Related to #31306 and vim/vim#16106. This doesn't provide `sfname`, but at least makes `args.file` have a consistent value.
| * | vim-patch:9.1.0903: potential overflow in spell_soundfold_wsal() (#31456)glepnir2024-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: potential overflow in spell_soundfold_wsal() Solution: Protect wres from buffer overflow, by checking the length (Zdenek Dohnal) Error: OVERRUN (CWE-119): vim91/src/spell.c:3819: cond_const: Checking "reslen < 254" implies that "reslen" is 254 on the false branch. vim91/src/spell.c:3833: incr: Incrementing "reslen". The value of "reslen" is now 255. vim91/src/spell.c:3792: overrun-local: Overrunning array "wres" of 254 4-byte elements at element index 254 (byte offset 1019) using index "reslen - 1" (which evaluates to 254). 3789| { 3790| // rule with '<' is used 3791|-> if (reslen > 0 && ws != NULL && *ws != NUL 3792| && (wres[reslen - 1] == c 3793| || wres[reslen - 1] == *ws)) Error: OVERRUN (CWE-119): vim91/src/spell.c:3819: cond_const: Checking "reslen < 254" implies that "reslen" is 254 on the false branch. vim91/src/spell.c:3833: overrun-local: Overrunning array "wres" of 254 4-byte elements at element index 254 (byte offset 1019) using index "reslen++" (which evaluates to 254). 3831| { 3832| if (c != NUL) 3833|-> wres[reslen++] = c; 3834| mch_memmove(word, word + i + 1, 3835| sizeof(int) * (wordlen - (i + 1) + 1)); related: vim/vim#16163 https://github.com/vim/vim/commit/39a94d20487794aeb722c21e84f8816e217f0cfe Co-authored-by: Zdenek Dohnal <zdohnal@redhat.com>
| * | vim-patch:9.1.0905: Missing information in CompleteDone event (#31455)glepnir2024-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Missing information in CompleteDone event Solution: add complete_word and complete_type to v:event dict (glepnir) closes: vim/vim#16153 https://github.com/vim/vim/commit/1c5a120a701fcf558617c4e70b5a447778f0e51d
| * | refactor(runtime.c): miscLewis Russell2024-12-04
| | |
| * | Merge #31358 fix test failures for release / tarball buildsJustin M. Keyes2024-12-04
| |\ \
| | * | test(marktree): expose test functions in release buildsJames McCoy2024-12-03
| | | | | | | | | | | | | | | | | | | | | | | | In order to run the marktree unit test in release mode, the test functions need to be available even when NDEBUG is defined. Keep the body of marktree_check a nop during release builds, which limits the usefulness of the testing, but at least lets the tests run.
| * | | fix(column): check if signcolumn changed in all windows #31439luukvbaal2024-12-04
| | | |
| * | | docs: misc, help tags for neovim.io searches #31428Justin M. Keyes2024-12-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Various keywords are commonly searched-for on https://neovim.io, but don't have help tags. Solution: Add help tags. fix #31327
| * | | fix(decorator): noisy errors from decoration provider #31418JD2024-12-03
| |/ / | | | | | | | | | | | | | | | | | | Problem: A broken decoration provider can cause endless errors. #27235 Solution: Don't show decorator errors when they exceed `DP_MAX_ERROR`.
| * | test(vterm): move test functions into vterm_test fixtureJames McCoy2024-12-02
| | | | | | | | | | | | | | | | | | | | | In order to run unittests with a release build, we need the test functions to be accessible when NDEBUG is defined. Moving the functions into the test fixture ensures they are available and only available for use by the unit tests.
| * | vim-patch:9.1.0900: Vim9: digraph_getlist() does not accept bool arg (#31431)zeertzjq2024-12-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Vim9: digraph_getlist() does not accept bool argument (Maxim Kim) Solution: accept boolean as first argument (Yegappan Lakshmanan) fixes: vim/vim#16154 closes: vim/vim#16159 https://github.com/vim/vim/commit/198ada3d9f48c6556d20c4115ec500555b118aad Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * | fix(extmark): builtin completion can still affect nearby extmarks #31387luukvbaal2024-12-02
| | | | | | | | | | | | | | | | | | | | | Problem: Built-in completion can still affect nearby extmarks. #31384 Solution: Restore extmarks when completion leader changes.
| * | fix(api): deprecate nvim_subscribe, nvim_unsubscribe #30456Justin M. Keyes2024-12-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: - nvim_subscribe, nvim_unsubscribe were deprecated in aec4938a21a02d279d13a9eb64ef3b7cc592c374 but this wasn't set in the API metadata. - The function annotations ``` FUNC_API_SINCE(1) FUNC_API_REMOTE_ONLY FUNC_API_DEPRECATED_SINCE(13) ``` cause this test to fail: ``` RUN T3 api metadata functions are compatible with old metadata or have new level: 3.00 ms ERR test/functional/api/version_spec.lua:135: function vim_subscribe was removed but exists in level 0 which nvim should be compatible with stack traceback: test/functional/api/version_spec.lua:135: in function <test/functional/api/version_spec.lua:128> ``` Solution: - Set the API metadata. - Rearrange the annotations so that FUNC_API_DEPRECATED_SINCE is 2nd: ``` FUNC_API_SINCE(1) FUNC_API_DEPRECATED_SINCE(13) FUNC_API_REMOTE_ONLY ```
| * | vim-patch:768728b: runtime(doc): Update documentation for "noselect" in ↵dundargoc2024-12-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'completeopt' In particular, make the distinction and interaction between "noinsert" and "noselect" clearer as it was very confusing before. closes: vim/vim#16148 https://github.com/vim/vim/commit/768728b48751c5e937409d12d98bfa1fb4c37266 Co-authored-by: dundargoc <gocdundar@gmail.com>
| * | fix(ui): clamp 'cmdheight' for other tabpages on screen resize (#31419)zeertzjq2024-12-02
| | |
| * | fix(api): make `nvim_set_hl()` respect all `cterm` attributes (#31390)Evgeni Chasnovski2024-12-02
| | |
| * | Merge pull request #31370 from glepnir/vim-9.1.0867zeertzjq2024-11-30
| |\ \ | | | | | | | | vim-patch:9.1.{0867,0891,0896}
| | * | vim-patch:9.1.0896: completion list wrong after v9.1.0891glepnir2024-11-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: completion list wrong after v9.1.0891 Solution: update compl_mach_array after leader change (glepnir) compl_shown_match update not correct after refactoring in v9.1.0891 Unfortunately, this regressed what item is selected after leader change. So generate compl_match_array before updating compl_shown_match range, and split generate compl_match_array into range match_head fixes: https://github.com/vim/vim/issues/16128 closes: https://github.com/vim/vim/pull/16129 https://github.com/vim/vim/commit/a49c077a883b2566882df9069385ed1e1277ca64
| | * | vim-patch:9.1.0891: building the completion list array is inefficientglepnir2024-11-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: building the completion list array is inefficient Solution: refactor and improve ins_compl_build_pum() func (glepnir) current time complexity is O(n^2). I guess garray is not used here to save memory and avoid efficiency is caused by heap memory allocation. A simple way is to add an extra pointer as a single linked list to store the matching compl_T, and traverse this single linked list to generate compl_match_array. The time complexity is O(n x m). The worst case is m=n, but we can still get a little improvement. Because the if condition does not need to be run at one time. This should be a good solution for now. Later we may be able to complete it in O(lgn) time. But this requires more reconstruction. So this is the first step. closes: #16125 https://github.com/vim/vim/commit/80b662009c0fe8f1728a3f3a2c8013b7eebf6745
| | * | vim-patch:9.1.0867: ins_compl_add() has too many argsglepnir2024-11-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ins_compl_add() has too many args Solution: refactor it and use an int array instead of 2 separate int args (glepnir) closes: vim/vim#16062 https://github.com/vim/vim/commit/5c66e23c624717216d380d938d0bba5d34a004fe Co-authored-by: glepnir <glephunter@gmail.com>
| * | | refactor: gen_declarations.luaLewis Russell2024-11-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: gen_declarations.lua is complex and has duplicate logic with c_grammar.lua Solution: Move all lpeg logic to c_grammar.lua and refactor gen_declarations.lua.
| * | | vim-patch:9.1.0892: the max value of 'cmdheight' is limited by other ↵zeertzjq2024-11-29
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tabpages (#31378) Problem: the max value of 'cmdheight' is limited by other tabpages Solution: Limit the maximum value of 'cmdheight' to the current tabpage only. (Milly) The Help says that cmdheight is local to the tab page, but says nothing about the maximum value depending on the state of all tab pages. Users may wonder why they can't increase cmdheight when there are still rows available on the current tab page. This PR changes the behavior of cmdheight so that its maximum value depends only on the state of the current tab page. Also, since magic numbers were embedded in various places with the minimum value of cmdheight being 1, we defined a constant to make it easier to understand. closes: vim/vim#16131 https://github.com/vim/vim/commit/2cddf0e85a7f8304476397e1c51dcd0e41835ac3 Cherry-pick Test_cmdheight_not_changed() from patch 9.0.0187. Co-authored-by: Milly <milly.ca@gmail.com>
| * | vim-patch:9.1.0890: %! item not allowed for 'rulerformat' (#31369)zeertzjq2024-11-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: %! item not allowed for 'rulerformat' (yatinlala) Solution: also allow to use %! for rulerformat option (Yegappan Lakshmanan) fixes: vim/vim#16091 closes: vim/vim#16118 https://github.com/vim/vim/commit/ac023e8baae65584537aa3c11494dad6f71770af Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
| * | feat(tui): update 'background' on theme change events (#31350)Gregory Anders2024-11-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enabling private DEC mode 2031 tells the terminal to notify Nvim whenever the OS theme changes (i.e. light mode to dark mode or vice versa) or the terminal emulator's palette changes. When we receive one of these notifications we query the terminal color's background color again to see if it has changed and update the value of 'background' if it has. We only do this though if the user has not explicitly set the value of 'bg' themselves. The help text is updated slightly to hint to users that they probably shouldn't set this value: on modern terminal emulators Nvim is able to completely determine this automatically.
| * | vim-patch:9.1.0889: Possible unnecessary redraw after adding/deleting lines ↵zeertzjq2024-11-26
| |/ | | | | | | | | | | | | | | | | | | | | (#31356) Problem: Possible unnecessary redraw after adding/deleting lines. Solution: Check b_mod_set before using b_mod_xlines to avoid using stale b_mod_xlines value (zeertzjq). closes: vim/vim#16124 https://github.com/vim/vim/commit/9f25a3a237156889df3df78dbd8f12ee6059e332
| * vim-patch:9.1.0888: leftcol property not available in getwininfo() (#31349)zeertzjq2024-11-26
| | | | | | | | | | | | | | | | | | | | Problem: leftcol property not available in getwininfo() Solution: add leftcol property property (glepnir) closes: vim/vim#16119 https://github.com/vim/vim/commit/0a850673e3d4193d55f47bcbbc0b0da5f155307d Co-authored-by: glepnir <glephunter@gmail.com>
| * fix(tui): also reset cursor color if it was invisible (#31348)Gregory Anders2024-11-25
| |
| * feat(keysets): teach Union and LuaRefOfLewis Russell2024-11-25
| |
| * fix(tui): only reset cursor color if it was changed (#31337)Gregory Anders2024-11-25
| | | | | | | | We already track this information so we might as well use it. This eliminates a bunch of unnecessary OSC sequences.
| * fix(grid): double grid_line_start() with ext_messages #31292luukvbaal2024-11-25
| | | | | | | | | | | | Problem: Hit double grid_line_start() assert when redrawing from ext_messages msg_ruler event. Solution: Do not start() batched grid calls when win_redr_ruler() will not puts() anything.
| * 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`.
| * vim-patch:9.1.0883: message history cleanup is missing some tests (#31331)zeertzjq2024-11-24
| | | | | | | | | | | | | | | | | | | | | | | | Problem: message history cleanup is missing some tests Solution: Add tests, refactor common code into did_set_msghistory() (Shougo Matsushita) closes: vim/vim#16078 https://github.com/vim/vim/commit/9f860a14c308f7a9a27a6850d36790615717a710 Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com> Co-authored-by: Milly <milly.ca@gmail.com>
| * refactor(options): autogenerate valid values and flag enums for options (#31089)Famiu Haque2024-11-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Option metadata like list of valid values for an option and option flags are not listed in the `options.lua` file and are instead manually defined in C, which means option metadata is split between several places. Solution: Put metadata such as list of valid values for an option and option flags in `options.lua`, and autogenerate the corresponding C variables and enums. Supersedes #28659 Co-authored-by: glepnir <glephunter@gmail.com>