aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* fix(repeat_cmdline): Save the repeat_cmdline when calling a userfunc.userregs_2Josh Rahm12 days
| | | | | | | | | | | | | | | | There's a very subtle bug when calling a userfunc where the redo buffer is saved, but the repeat_cmdline is not. This causes the redo buffer on do-repeat to call the most recently executed userfunc rather than the userfunc it should be dot-repeating. This is only an issue when trying to dot-repeat a userfunction within a user function. I found this bug when experimenting with using text motions, specifically the Z* verbs in fieldmarshal. Specifically the Z* motions (for inserting/appending before/after a text object) would be dot-repeatable for builtin text objects, but would not be dot-repeatable for user-defined text objects.
* feat(userregfunc): programmable user-defined registers with multibyte supportJosh Rahm12 days
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces a new global option `userregfunc`, allowing users to define custom behavior for registers not handled by Neovim internally. This enables programmable registers using any Unicode character — including multibyte characters. - A new register slot `USER_REGISTER` is introduced. Any register not matching the standard set (`0-9a-zA-Z"+-*%#/:.=`, etc.) is routed through this system. - When such a register is accessed, the function defined in `userregfunc` is called with three arguments: 1. `{action}` (string): either `"yank"` or `"put"` 2. `{register}` (string): UTF-8 character name of the register 3. `{content}`: - If `action == "yank"`: a dictionary with these keys: - `lines` (list of strings): the yanked text - `type` (string): one of `"v"` (charwise), `"V"` (linewise), or `"b"` (blockwise) - `width` (number, optional): present if `type == "b"` - `additional_data` (dict, optional): user-extensible metadata - If `action == "put"`: this is always `v:null` - The function may return either: - A **string** (used as a charwise register), or - A **dictionary** matching the structure above - Internally, `read_userregister()` and `write_userregister()` convert between `yankreg_T` and typval dictionaries. - Messages and internal logic fully support multibyte register names via UTF-8. - A new `USER_REGISTER` slot is used for logical separation in the register table. Included in this patch is an extensible Lua framework (`vim.userregs`) for defining user register handlers in Lua. It provides per-register handlers via `register_handler(registers, handler)` The global function `_G.def_userreg_func` is registered as the default implementation of `'userregfunc'`, enabling seamless integration with the Lua framework. - Register `λ` dynamically inserts the current date - Register `&` reads and writes from a "global register" file under `stdpath("run")` - Register `?` returns the result of a shell command - Registers that auto-adjust based on filetype, cursor context, or Treesitter nodes This change expands the register model into a programmable abstraction — fully scriptable and extensible — without breaking compatibility.
* vim-patch:9.1.1288: Using wrong window in ll_resize_stack() (#33397)zeertzjq2025-04-09
| | | | | | | | | | Problem: Using wrong window in ll_resize_stack() (after v9.1.1287) Solution: Use "wp" instead of "curwin", even though they are always the same value. Fix typos in documentation (zeertzjq). closes: vim/vim#17080 https://github.com/vim/vim/commit/b71f1309a210bf8f61a24f4eda336de64c6f0a07
* fix(editor): respect [+cmd] when executing :drop #33339jyn2025-04-08
| | | | | | | | | | | | | | Problem: Normally, `:drop +41 foo.txt` will open foo.txt with the cursor on line 41. But if foo.txt is already open, it instead is a no-op, even if the cursor is on a different line. Steps to reproduce: nvim --clean foo.txt :drop +30 foo.txt Solution: Handle +cmd in ex_drop().
* fix(display): scroll redrawing doesn't account for virt_lines above fold #33374luukvbaal2025-04-08
| | | | | | Problem: Logic computing the new height of the modified area does not take into account virtual lines attached to a folded line. Solution: Remove `hasFolding()` branch and let `plines_win_full()` do its job.
* vim-patch:9.1.1287: quickfix code can be further improvedzeertzjq2025-04-08
| | | | | | | | | | | | | | | | | | | | Problem: quickfix code can be further improved (after v9.1.1283) Solution: slightly refactor quickfix.c (Hirohito Higashi) - remove error message output - adjust comments - rename functions: - qf_init_quickfix_stack() --> qf_init_stack() - qf_resize_quickfix_stack() --> qf_resize_stack() - qf_resize_stack() --> qf_resize_stack_base() Now qf_alloc_stack() can handle both quickfix/location lists. closes: vim/vim#17068 https://github.com/vim/vim/commit/adcfb6caeb1c9c54448fff8d5812c3dca2ba0d03 Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
* vim-patch:9.1.1283: quickfix stack is limited to 10 itemszeertzjq2025-04-08
| | | | | | | | | | | | | | Problem: quickfix and location-list stack is limited to 10 items Solution: add the 'chistory' and 'lhistory' options to configure a larger quickfix/location list stack (64-bitman) closes: vim/vim#16920 https://github.com/vim/vim/commit/88d41ab270a8390a43da97a903b1a4d76b89d330 Co-authored-by: 64-bitman <60551350+64-bitman@users.noreply.github.com> Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
* vim-patch:9.1.1253: abort when closing window with attached quickfix datazeertzjq2025-04-08
| | | | | | | | | | | | | | | | | | | Problem: If win_close() is called with a window that has quickfix stack attached to it, the corresponding quickfix buffer will be closed and freed after the buffer was already closed. At that time curwin->w_buffer points to NULL, which the CHECK_CURBUF will catch and abort if ABORT_ON_ERROR is defined Solution: in wipe_qf_buffer() temporarily point curwin->w_buffer back to curbuf, the window will be closed anyhow, so it shouldn't matter that curbuf->b_nwindows isn't incremented. closes: vim/vim#16993 closes: vim/vim#16985 https://github.com/vim/vim/commit/ce80c59bfd3c0087a354ee549639ca60fa192fba Co-authored-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
* fix(decor): enable decoration provider in on_start #33337luukvbaal2025-04-07
| | | | | | | | Problem: An on_win-disabled decoration provider is left disabled for the on_buf callback during the next redraw (if the provider does not subscribe to on_end). Solution: Move re-activation of the provider from after the on_end callback to before the on_start callback.
* fix(defaults): keywordprg=:help on Windows #33336Emanuel Krollmann2025-04-07
| | | | | | | | | | Problem: As `:h kp` says, the default value for keywordprg should be ':help' on Windows. It is currently always ':Man'. Solution: Add condition to options.lua which sets keywordprg to ':help' if running on windows.
* build: bump NVIM_API_LEVEL #33340Justin M. Keyes2025-04-05
| | | | | Bumping NVIM_API_LEVEL is pretty much required after every major release, because it's also used to correlated Lua stdlib changes to a Nvim version.
* docs: clipboard, eval #33223Justin M. Keyes2025-04-05
|
* vim-patch:9.1.1276: inline word diff treats multibyte chars as word char ↵zeertzjq2025-04-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#33323) Problem: inline word diff treats multibyte chars as word char (after 9.1.1243) Solution: treat all non-alphanumeric characters as non-word characters (Yee Cheng Chin) Previously inline word diff simply used Vim's definition of keyword to determine what is a word, which leads to multi-byte character classes such as emojis and CJK (Chinese/Japanese/Korean) characters all classifying as word characters, leading to entire sentences being grouped as a single word which does not provide meaningful information in a diff highlight. Fix this by treating all non-alphanumeric characters (with class number above 2) as non-word characters, as there is usually no benefit in using word diff on them. These include CJK characters, emojis, and also subscript/superscript numbers. Meanwhile, multi-byte characters like Cyrillic and Greek letters will still continue to considered as words. Note that this is slightly inconsistent with how words are defined elsewhere, as Vim usually considers any character with class >=2 to be a "word". related: vim/vim#16881 (diff inline highlight) closes: vim/vim#17050 https://github.com/vim/vim/commit/9aa120f7ada592ed03b37f4de8ee413c5385f123 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* fix(messages): verbose message emitted without kind #33305luukvbaal2025-04-04
| | | | | Problem: Successive autocmd verbose messages may be emitted without a kind. Solution: Always set the kind when preparing to emit a verbose message.
* feat(defaults): store spellfile in stdpath('data') #33048Yochem van Rosmalen2025-04-04
| | | | | | | | | | | Problem: First rtp directory is unpredictable and not in line with XDG base spec. Solution: Use stdpath('data')/spell as directory if 'spellfile' is not set. Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* vim-patch:9.1.1272: completion: in keyword completion Ctrl_P cannot go back ↵glepnir2025-04-04
| | | | | | | | | | | | | | | | after Ctrl_N Problem: completion: in keyword completion Ctrl_P cannot go back after Ctrl_N Solution: in find_compl_when_fuzzy() always return first match of array, after Ctrl_P use compl_shown_match->cp_next instead of compl_first_match. (glepnir) closes: vim/vim#17043 https://github.com/vim/vim/commit/3e50a28a03d136c1e0c1f4fabe50d97faaf08c5c Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.1269: completion: compl_shown_match is updated when starting ↵glepnir2025-04-03
| | | | | | | | | | | | | | | | keyword completion Problem: compl_shown_match is updated when starting keyword completion and does not include fuzzy matching. Solution: Do not update compl_shown_match when starting keyword completion, since it is the one already selected by the keyword completion direction. (glepnir) closes: vim/vim#17033 https://github.com/vim/vim/commit/e4e4d1c381e9d0af55f6111e9bcaf98ad60461fc Co-authored-by: glepnir <glephunter@gmail.com>
* fix(events): crash on SIGTSTP (Ctrl-Z) #33258phanium2025-04-02
| | | | | | | | | | Problem: Nvim crashes on receive SIGTSTP (Ctrl-Z) since 4dabeff308222307ede8e74a2bd341713a7f7d81. Solution: * Don't exit on SIGTSTP (not a deadly signal). * Avoid SIGTSTP handler in os/signal.c. Co-authored-by: 27Onion Nebell <zzy20080201@gmail.com>
* fix(highlight): no match highlight during :substitute prompt #33262luukvbaal2025-04-02
| | | | | | Problem: Redrawing during a substitute confirm prompt causes the match highlight to disappear. Solution: Unset `highlight_match` after the prompt has returned. Use global highlight definitions in searchhl_spec.lua.
* vim-patch:9.1.1266: MS-Windows: type conversion warnings (#33264)zeertzjq2025-04-02
| | | | | | | | | | Problem: MS-Windows: type conversion warnings Solution: cast the variables (Yegappan Lakshmanan) closes: vim/vim#17027 https://github.com/vim/vim/commit/7b6add0b4a694d421a1eb9c9017698ccbedde41c Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* fix(api): nvim_set_keymap() throws error even in pcall() #33228tstsrt2025-04-01
| | | | | | | | Problem: When `nvim_set_keymap` tries to overwrite a `<unique>` mapping, it throws an error even when called in `pcall`. Solution: src/nvim/mapping.c:buf_do_map no longer calls `semsg`. Its callers now decide whether to ignore the error, or use `semsg` (not caught)/`api_set_error` (caught by `pcall`).
* fix(window): crash on negative window height with 'winbar' #33250luukvbaal2025-04-01
| | | | Problem: Negative window and grid height with 'winbar'. Solution: Clamp the height when subtracting the 'winbar' height.
* docs(eval): fix dict param type of mapsetSean Dewar2025-04-01
| | | | Match maparg's return type.
* docs(eval): fix lnum type for functions using tv_get_lnumSean Dewar2025-04-01
| | | | | | | These occurrences also accept string, which is used like in getline. Also make the lnum field of vim.fn.sign_placelist.list.item optional, as it can be omitted like vim.fn.sign_place.dict's.
* fix(display): wrong cursor column with 'concealcursor' = "n" and virt_text ↵luukvbaal2025-04-01
| | | | | | | (#33218) Problem: Inline virtual text placed in a decor provider callback invalidates `w_virtcol`, which must be valid for `win_line()`. Solution: Call `validate_virtcol()` after "line" decor provider callbacks.
* fix(move): adjust for concealed lines above topline after scrolling up (#33211)luukvbaal2025-04-01
| | | | | | Problem: Scrolling up does not adjust `w_topline` for concealed lines directly above it, resulting in (non-visual) asymmetry when scrolling up/down. Solution: Adjust `w_topline` for concealed lines after scrolling up.
* feat(float): 'winborder' "bold" style #33189glepnir2025-03-31
|
* feat(editor): 'autowriteall' on SIGHUP/SIGQUIT #32843Skoh2025-03-31
| | | | | | | | | | | Problem: Upon receiving a deadly signal, Nvim doesn't write buffers even if the option 'autowriteall' is set. Solution: Write to all writable buffers upon SIGHUP or SIGQUIT (but not SIGTERM), if the option 'autowriteall' is set. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* Merge pull request #32440 from fredizzimo/message-attachbfredl2025-03-31
|\ | | | | fix(ui): send multigrid message position and size when the UI is refreshed
| * fix(ui): send multigrid message position and size when the UI is refreshedFred Sundvik2025-03-27
| |
* | fix(terminal): emit Termrequest for all OSC sequences #33181phanium2025-03-30
| | | | | | | | | | Problem: osc 0/1/2/52 didn't emit TermRequest. Solution: emit `TermRequest` for all recognized osc.
* | docs: lsp config/commands #33122Justin M. Keyes2025-03-30
| | | | | | fix #33075
* | docs: faq, lua packages #33183Phạm Bình An2025-03-30
| | | | | | | | | | | | Problem: - `health#check()` seems to have been removed for a while, but `:h faq` still refers to it. - `news-0.11.txt` doesn't mention #33044
* | vim-patch:9.1.1263: string length wrong in get_last_inserted_save() (#33194)zeertzjq2025-03-30
| | | | | | | | | | | | | | | | | | | | | | | | Problem: string length wrong in get_last_inserted_save() (after v9.1.1222) Solution: when removing trailing ESC, also decrease the string length (Christ van Willegen) closes: vim/vim#16961 https://github.com/vim/vim/commit/583f5aee96940c29ba17ffb87f1ddf56741b72ba Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
* | vim-patch:9.1.1260: Hang when filtering buffer with NUL bytes (#33192)zeertzjq2025-03-30
| | | | | | | | | | | | | | | | | | Problem: Hang when filtering buffer with NUL bytes (after 9.1.1050). Solution: Don't subtract "written" from "lplen" repeatedly (zeertzjq). related: neovim/neovim#33173 closes: vim/vim#17011 https://github.com/vim/vim/commit/53fed23cb7bd59d9400961b44c6c8dca0029c929
* | fix(api): use E226 instead of E227 for duplicate abbreviation (#33159)zeertzjq2025-03-30
| |
* | refactor(treesitter): migrate to ts parser callback API #33141Riley Bruins2025-03-29
| | | | | | | | | | Remove the `set_timeout` functions for `TSParser` and instead add a timeout parameter to the regular parse function. Remove these deprecated tree-sitter API functions and replace them with the preferred `TSParseOptions` style.
* | Merge pull request #33114 from zeertzjq/vim-9.1.1250zeertzjq2025-03-29
|\ \ | | | | | | vim-patch:9.1.{1250,1255,1257}: 'pummaxwidth'
| * | vim-patch:9.1.1257: Mixing vim_strsize() with mb_ptr2cells() in pum_redraw()zeertzjq2025-03-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Mixing vim_strsize() with mb_ptr2cells() in pum_redraw(). Solution: Change vim_strsize() to mb_string2cells() (zeertzjq). Since vim_strsize() uses ptr2cells() for the cell width of each char, it is strange to mix it with mb_ptr2cells(), which is used both just below and in pum_screen_puts_with_attr(), and screen_puts_len() also uses something similar. Meanwhile mb_string2cells() uses mb_ptr2cells() for the cell width of each char. Note that the vim_strsize() and mb_string2cells() actually return the same value here, as the transstr() above makes sure the string only contains printable chars, and ptr2cells() and mb_ptr2cells() only return different values for unprintable chars. closes: vim/vim#17003 https://github.com/vim/vim/commit/90e52490b39f0052fb5313d67728eff77191aaae
| * | fix(pum): simplify 'pummaxwidth' truncation and avoid crashzeertzjq2025-03-29
| | |
| * | vim-patch:9.1.1255: missing test condition for 'pummaxwidth' settingzeertzjq2025-03-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: missing test condition for 'pummaxwidth' setting, pummaxwidth not effective when width is 32 and height is 10 (after v9.1.1250) Solution: add missing comparison condition in pum_width() (glepnir) closes: vim/vim#16999 https://github.com/vim/vim/commit/532c5aec6fa8f0a3d743c7d1573d25d75dd36d5f Co-authored-by: glepnir <glephunter@gmail.com>
| * | vim-patch:9.1.1250: cannot set the maximum popup menu widthzeertzjq2025-03-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: cannot set the maximum popup menu width (Lucas Mior) Solution: add the new global option value 'pummaxwidth' (glepnir) fixes: vim/vim#10901 closes: vim/vim#16943 https://github.com/vim/vim/commit/88d75934c3d5bc4c406343f106e1a61638abd3a7 Co-authored-by: glepnir <glephunter@gmail.com>
* | | fix(api): use original LHS in keymap error message #33135Gregory Anders2025-03-29
|/ / | | | | | | | | | | | | | | | | | | | | | | When setting a keymap with "unique" that already exists the error message contains the LHS of the keymap with termcodes replaced. In particular this means that keys like <Tab> show as an actual tab character, meaning the error message displays as "Mapping already exists for ", which is hard to debug for users. Instead, display the original LHS (without any simplification or parsed termcodes). This rperesents exactly what the user passed to the `lhs` argument of `nvim_set_keymap`, which makes it easier to find where the offending keymap is.
* | vim-patch:9.1.1258: regexp: max \U and \%U value is limited by INT_MAX (#33156)zeertzjq2025-03-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: regexp: max \U and \%U value is limited by INT_MAX but gives a confusing error message (related: v8.1.0985). Solution: give a better error message when the value reaches INT_MAX When searching Vim allows to get up to 8 hex characters using the /\V and /\%V regex atoms. However, when using "/\UFFFFFFFF" the code point is already above what an integer variable can hold, which is 2,147,483,647. Since patch v8.1.0985, Vim already limited the max codepoint to INT_MAX (otherwise it caused a crash in the nfa regex engine), but instead of error'ing out it silently fell back to parse the number as a backslash value and not as a codepoint value and as such this "/[\UFFFFFFFF]" will happily find a "\" or an literal "F". And this "/[\d127-\UFFFFFFFF]" will error out as "reverse range in character class). Interestingly, the max Unicode codepoint value is U+10FFFF which still fits into an ordinary integer value, which means, that we don't even need to parse 8 hex characters, but 6 should have been enough. However, let's not limit Vim to search for only max 6 hex characters (which would be a backward incompatible change), but instead allow all 8 characters and only if the codepoint reaches INT_MAX, give a more precise error message (about what the max unicode codepoint value is). This allows to search for "[\U7FFFFFFE]" (will likely return "E486 Pattern not found") and "[/\U7FFFFFF]" now errors "E1517: Value too large, max Unicode codepoint is U+10FFFF". While this change is straight forward on architectures where long is 8 bytes, this is not so simple on Windows or 32bit architectures where long is 4 bytes (and therefore the test fails there). To account for that, let's make use of the vimlong_T number type and make a few corresponding changes in the regex engine code and cast the value to the expected data type. This however may not work correctly on systems that doesn't have the long long datatype (e.g. OpenVMS) and probably the test will fail there. fixes: vim/vim#16949 closes: vim/vim#16994 https://github.com/vim/vim/commit/f2b16986a194ab839c5a23bd7fe904f9fae1526f Co-authored-by: Christian Brabandt <cb@256bit.org>
* | refactor(diff): remove unreachable code (#33149)zeertzjq2025-03-29
| |
* | fix(pum): fix heap-buffer-overflow with 'rightleft' (#33146)zeertzjq2025-03-29
| |
* | vim-patch:9.1.1252: typos in code and docs related to 'diffopt' "inline:" ↵zeertzjq2025-03-29
| | | | | | | | | | | | | | | | | | | | | | | | (#33143) Problem: Typos in code and docs related to 'diffopt' "inline:". (after v9.1.1243) Solution: Fix typos and slightly improve the docs. (zeertzjq) closes: vim/vim#16997 https://github.com/vim/vim/commit/5a307c361cbe9f7ac438a917b905378d87f8f2de
* | fix(cmdline): avoid empty @: register after :<CR> (#33126)luukvbaal2025-03-28
| | | | | | Fix https://github.com/neovim/neovim/issues/33125
* | fix(cmdline): empty ext_cmdline block events for :<CR> #33118luukvbaal2025-03-28
| | | | | | | | | | Problem: An ext_cmdline block event that should be empty after :<CR> re-emits the previous cmdline. Solution: Clear `last_cmdline` even when `new_last_cmdline == NULL`.
* | fix(mouse): crash with click on win-separator in statusline (#33091)Shadman2025-03-28
| | | | | | | | | | | | | | Problem: Clicking on window separator in statusline crashes Nvim due to out of bound memory access Solution: Check if the click location is within clicking range before applying it.