aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* vim-patch:9.1.1169: using global variable for get_insert()/get_lambda_name() ↵zeertzjq2025-03-03
| | | | | | | | | | | | | | | | | | | | (#32713) Problem: using global variable for get_insert()/get_lambda_name() (after v9.1.1151) Solution: let the functions return a string_T object instead (Yee Cheng Chin) In vim/vim#16720, `get_insert()` was modified to store a string length in a global variable to be queried immediately by another `get_insert_len()` function, which is somewhat fragile. Instead, just have the function itself return a `string_T` object instead. Also do the same for `get_lambda_name()` which has similar issues. closes: vim/vim#16775 https://github.com/vim/vim/commit/0b5fe420715786249cd121d845dbd6a81f962d1b Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:9.1.1167: mark '] wrong after copying text object (#32712)zeertzjq2025-03-04
| | | | | | | | | | | | Problem: mark '] wrong after copying text object (ubaldot) Solution: Adjust position of '] for non-linewise, exclusive motions (Jim Zhou) related: vim/vim#16679 closes: vim/vim#16772 https://github.com/vim/vim/commit/360a39ae6c823dd3e3c89c209b544f345c6d86dd Co-authored-by: Jim Zhou <jimzhouzzy@gmail.com>
* vim-patch:659cb28: runtime(doc): fix typo "bet" in :h 'completeopt' (#32711)zeertzjq2025-03-04
| | | | | closes: vim/vim#16773 https://github.com/vim/vim/commit/659cb28c25b756e59c712c337f8b4650e85f8bcd
* vim-patch:9.1.1168: wrong flags passed down to nextwild()zeertzjq2025-03-04
| | | | | | | | | | | | | | | | Problem: wrong flags passed down to nextwild() (zeertzjq, after v9.1.1166) Solution: only pass options flags (Girish Palya) `options` needs to be passed into nextwild() since it may contain WILD_KEEP_SOLE_ITEM which prevents the menu items list from getting freed if there is only 1 item left (if `noselect` is set). closes: vim/vim#16778 https://github.com/vim/vim/commit/d2219d547d2e70ba7af498866b0d12d3b6517b16 Co-authored-by: Girish Palya <girishji@gmail.com>
* vim-patch:9.1.1166: command-line auto-completion hard with wildmenuTomas Slusny2025-03-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: command-line auto-completion hard with wildmenu Solution: implement "noselect" wildoption value (Girish Palya) When `noselect` is present in `wildmode` and 'wildmenu' is enabled, the completion menu appears without pre-selecting the first item. This change makes it easier to implement command-line auto-completion, where the menu dynamically appears as characters are typed, and `<Tab>` can be used to manually select an item. This can be achieved by leveraging the `CmdlineChanged` event to insert `wildchar(m)`, triggering completion menu. Without this change, auto-completion using the 'wildmenu' mechanism is not feasible, as it automatically inserts the first match, preventing dynamic selection. The following Vimscript snippet demonstrates how to configure auto-completion using `noselect`: ```vim vim9script set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu autocmd CmdlineChanged : timer_start(0, function(CmdComplete, [getcmdline()])) def CmdComplete(cur_cmdline: string, timer: number) var [cmdline, curpos] = [getcmdline(), getcmdpos()] if cur_cmdline ==# cmdline # Avoid completing each character in keymaps and pasted text && !pumvisible() && curpos == cmdline->len() + 1 if cmdline[curpos - 2] =~ '[\w*/:]' # Reduce noise by completing only selected characters feedkeys("\<C-@>", "ti") set eventignore+=CmdlineChanged # Suppress redundant completion attempts timer_start(0, (_) => { getcmdline()->substitute('\%x00$', '', '')->setcmdline() # Remove <C-@> if no completion items exist set eventignore-=CmdlineChanged }) endif endif enddef ``` fixes: vim/vim#16551 closes: vim/vim#16759 https://github.com/vim/vim/commit/2bacc3e5fb3569e0fd98e129cb1e422ca18b80a6 Cherry-pick Wildmode_Tests() change from patch 9.0.0418. Co-authored-by: Girish Palya <girishji@gmail.com> Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
* vim-patch:9.1.1165: diff: regression with multi-file diff blocks (#32702)zeertzjq2025-03-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Vim's diff block merging algorithm when doing a multi-file diff is buggy when two different diff hunks overlap a single existing diff block (after v9.1.0743) Solution: fix a couple bugs in this logic: 1. Fix regression from v9.1.0743 where it's not correctly expanding the 2nd overlap correctly, where it always expands without taking into account that this was always taken care of when the first overlap happened. Instead, we should only grow the 2nd overlap if it overhangs outside the existing diff block, and if we encounter a new overlapping diff block (due to overlap chaining). 2. When we expand a diff block to match the hunk size on the orig side (when handling the first overlap), we expand the same amount of lines in the new side. This is not sound if there exists a second overlap hunk that we haven't processed yet, and that hunk has different number of lines in orig/new. Fix this by doing the corresponding counter adjustment when handling 2nd/3rd/etc overlap by calculating the difference in lines between orig and new side. (Yee Cheng Chin) closes: vim/vim#16768 https://github.com/vim/vim/commit/bc08ceb75572dcac57ef5019f3d0df6e8290c0f9 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* docs: misc #31996Justin M. Keyes2025-03-02
|
* build!: turn off translations by defaultdundargoc2025-03-02
| | | | | The translation step prolongs the build time too much to be enabled by default. Enable it by passing cmake flag `ENABLE_TRANSLATIONS=ON`.
* vim-patch:9.1.1161: preinsert requires bot "menu" and "menuone" to be setzeertzjq2025-03-02
| | | | | | | | | | | | Problem: preinsert requires bot "menu" and "menuone" to be set, but "menu" is redundant (after v9.1.1160) Solution: preinsert only requires menuone (glepnir) closes: vim/vim#16763 https://github.com/vim/vim/commit/94a045ed56d7616c0cd0080d3f308d6cf9fbe64c Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.1160: Ctrl-Y does not work well with "preinsert" when ↵zeertzjq2025-03-02
| | | | | | | | | | | | | | | | | | | | | completing items Problem: The 'preinsert' feature requires Ctrl-Y to confirm insertion, but Ctrl-Y only works when the popup menu (pum) is displayed. Without enforcing this dependency, it could lead to confusing behavior or non-functional features. Solution: Modify ins_compl_has_preinsert() to check for both 'menu' and 'menuone' flags when 'preinsert' is set. Update documentation to clarify this requirement. This avoids adding complex conditional behaviors. (glepnir) fixes: vim/vim#16728 closes: vim/vim#16753 https://github.com/vim/vim/commit/a2c5559f297a18dc1ce3c4f1f9fd6204aed321c9 Co-authored-by: glepnir <glephunter@gmail.com>
* feat(treesitter): add more metadata to `language.inspect()` (#32657)Lewis Russell2025-03-01
| | | | | | | | | Problem: No way to check the version of a treesitter parser. Solution: Add version metadata (ABI 15 parsers only) as well as parser state count and supertype information (ABI 15) in `vim.treesitter.language.inspect()`. Also graduate the `abi_version` field, as this is now the official upstream name. --------- Co-authored-by: Christian Clason <c.clason@uni-graz.at>
* vim-patch:9.1.1158: :verbose set has wrong file name with :compiler! (#32682)zeertzjq2025-02-28
| | | | | | | | Problem: :verbose set has wrong file name with :compiler! Solution: Add -keepscript (zeertzjq) closes: vim/vim#16752 https://github.com/vim/vim/commit/5e8b2268e180cbf5079ea6dbe9c8fd29c3e3133c
* fix(marks): ineffective conceal_line callback optimization (#32662)luukvbaal2025-02-28
| | | | | | | Problem: _on_conceal_line callbacks are not invoked if callback has not let Nvim know it wants to receive them. But this may change on factors other than what is currently checked (changed buffer). Solution: Forego this optimization, callback is still guarded behind 'conceallevel'.
* vim-patch:8.2.4974: ":so" command may read after end of bufferzeertzjq2025-02-28
| | | | | | | | | Problem: ":so" command may read after end of buffer. Solution: Compute length of text properly. https://github.com/vim/vim/commit/4748c4bd64610cf943a431d215bb1aad51f8d0b4 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.2.4647: "source" can read past end of copied linezeertzjq2025-02-28
| | | | | | | | | Problem: "source" can read past end of copied line. Solution: Add a terminating NUL. https://github.com/vim/vim/commit/2bdad6126778f907c0b98002bfebf0e611a3f5db Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.2.4603: sourcing buffer lines is too complicatedzeertzjq2025-02-28
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Sourcing buffer lines is too complicated. Solution: Simplify the code. Make it possible to source Vim9 script lines. (Yegappan Lakshmanan, closes vim/vim#9974) https://github.com/vim/vim/commit/85b43c6cb7d56919e245622f4e42db6d8bee4194 This commit changes the behavior of sourcing buffer lines to always have a script ID, although sourcing the same buffer always produces the same script ID. vim-patch:9.1.0372: Calling CLEAR_FIELD() on the same struct twice Problem: Calling CLEAR_FIELD() on the same struct twice. Solution: Remove the second CLEAR_FIELD(). Move the assignment of cookie.sourceing_lnum (zeertzjq). closes: vim/vim#14627 https://github.com/vim/vim/commit/f68517c1671dfedcc1555da50bc0b3de6d2842f6 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* vim-patch:8.2.4594: need to write script to a file to be able to source themzeertzjq2025-02-28
| | | | | | | | | | | | | Problem: Need to write script to a file to be able to source them. Solution: Make ":source" use lines from the current buffer. (Yegappan Lakshmanan et al., closes vim/vim#9967) https://github.com/vim/vim/commit/36a5b6867bb6c0bd69c8da7d788000ab8a0b0ab0 Most code and test changes are reverted or modified again in patch 8.2.4603, so only port parts that are untouched in patch 8.2.4603. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* vim-patch:85a50fe: runtime(doc): fix confusing docs for 'completeitemalign' ↵zeertzjq2025-02-28
| | | | | | | (#32671) closes: vim/vim#16743 https://github.com/vim/vim/commit/85a50fe825ba11a35ce654f7313b4350e3ba4b52
* vim-patch:9.1.1157: command completion wrong for input() (#32669)zeertzjq2025-02-28
| | | | | | | | | | | | | Problem: command completion wrong for input() (Cdrman Fu) Solution: Set commandline completion context explicitly (Jim Zhou) fixes vim/vim#16723 closes: vim/vim#16733 https://github.com/vim/vim/commit/3255af850e8bab35c30fce4177bb5ba4a941e6ce Co-authored-by: Jim Zhou <csd_189@163.com>
* vim-patch:9.1.1155: Mode message not cleared after :silent message (#32667)zeertzjq2025-02-27
| | | | | | | | | | | Problem: Mode message not cleared after :silent message (after 9.0.1634). Solution: Don't reset mode_displayed when the message is empty. (zeertzjq) fixes: neovim/neovim#32641 closes: vim/vim#16744 https://github.com/vim/vim/commit/fce1fa5b618458f6f10028faadc9a9ddc227fe76
* fix(lua): wrong script context for option set by func from nvim_exec2 (#32659)zeertzjq2025-02-27
| | | | | | | | | Problem: Wrong script context for option set by function defined by nvim_exec2 in a Lua script. Solution: Call nlua_set_sctx() after adding SOURCING_LNUM and always set sc_lnum for a Lua script. This is a bug discovered when testing #28486. Not sure if this actually happens in practice, but it's easy to fix and required for #28486.
* fix(display): correctly store winline info for concealed lines (#32656)luukvbaal2025-02-27
| | | Off-by-one error in storing last line number for a logical line.
* fix(popup): reuse pum preview float win, set 'winfixbuf' #32636glepnir2025-02-27
| | | | | | | | | | | Problem: popup floating window is closed and recreated for each item selection, this is a bit wasteful. Solution: - Hide the preview win (instead of closing it) when the menu is still displayed: 1. When selected_item is -1. 2. When switching from an item with an "info" field to one without. - When pum is undisplayed it is still closed.
* doc: clarify window-id, tab-id, nvim_set_current_x #32528David Briscoe2025-02-27
| | | | | | | | | | | | | | Problem: Descriptions are somewhat vague. nvim_set_current_line modifies contents but nvim_set_current_buf does not, etc. Solution: - Make it clear that these functions accept or return a winid/tabid by linking to that concept in help. - Only these few files use the term "handles", so replace them with the more conventional terminology. - Add a new help section for tab-ID. This concept is unique to neovim because vim exposes tabnr, but not tab handles. This section is modelled after `:h winid`.
* refactor(do_source): remove duplicate assignments (#32654)zeertzjq2025-02-27
| | | The code above have already set sc_lnum to 0.
* fix(move): 'scrolloff' cursor correction no longer handles folds properly ↵luukvbaal2025-02-27
| | | | | | | (#32642) Problem: f58e7d5f passed `&botline` to `plines_win_full()`, (probably) assuming it would be set to the first line of the fold. Solution: Reinstate call to `hasFolding()` to do so.
* refactor(shada): fix coverity warning about leaking memory (#32650)zeertzjq2025-02-27
|
* vim-patch:9.1.1152: Patch v9.1.1151 causes problemszeertzjq2025-02-27
| | | | | | | | | | | Problem: Patch v9.1.1151 causes problems Solution: partially revert it (John Marriott) closes: vim/vim#16736 https://github.com/vim/vim/commit/18bacc811c30ba26405cadbeb79d9013d9885bb5 Co-authored-by: John Marriott <basilisk@internode.on.net>
* vim-patch:9.1.1151: too many strlen() calls in getchar.czeertzjq2025-02-27
| | | | | | | | | | | | | Problem: too many strlen() calls in getchar.c Solution: store last inserted and recorded lengths, add functions to retrieve those and use those functions (John Marriott) closes: vim/vim#16720 https://github.com/vim/vim/commit/d3c4b7e9461f90bad7a671c1221d65def9cccc89 Co-authored-by: John Marriott <basilisk@internode.on.net>
* refactor: old references to scripts/ dir #32647Justin M. Keyes2025-02-26
|
* feat(lua): vim.text.indent()Justin M. Keyes2025-02-26
| | | | | | | | | | | | | Problem: Indenting text is a common task in plugins/scripts for presentation/formatting, yet vim has no way of doing it (especially "dedent", and especially non-buffer text). Solution: Introduce `vim.text.indent()`. It sets the *exact* indentation because that's a more difficult (and thus more useful) task than merely "increasing the current indent" (which is somewhat easy with a `gsub()` one-liner).
* fix(shada): ":wshada/:rshada [filename]" with shadafile=NONE #32538IpsumCapra2025-02-26
| | | | | | | | | | | Problem: read/write shada function logic was skipped entirely if it was detected the shadafile option was set to 'NONE'. Solution: The filename is now always resolved. When the shadafile option is set to 'NONE' AND no filename was passed, the filename resolves to an empty string, which causes the read/write functions to return. Regardless of whether the option is set to 'NONE', when a filename is explicitly passed, it gets resolved and the read/write logic is accessed.
* build: move all generator scripts to `src/gen/`Lewis Russell2025-02-26
| | | | | | | | | | | - Move all generator Lua scripts to the `src/gen/` - Add a `.luarc.json` to `src/gen/` - Add a `preload.lua` to `src/gen/` - Add `src` to `package.path` so it aligns with `.luarc.json' - Fix all `require` statements in `src/gen/` so they are consistent: - `require('scripts.foo')` -> `require('gen.foo')` - `require('src.nvim.options')` -> `require('nvim.options')` - `require('api.dispatch_deprecated')` -> `require('nvim.api.dispatch_deprecated')`
* refactor(gen_api_dispatch): avoid trailing spaces (#32632)zeertzjq2025-02-26
| | | | | | | | | | Problem: Generated Lua API bindings may have trailing spaces (e.g. nvim_set_hl). Solution: Add leading spaces only if arg_free_code is non-empty. Also: - Remove an unnecessary string.format() in write_shifted_output() args. - Fix incorrect indent for the nlua_push_keydict() below.
* Merge pull request #32631 from jamessan/snprintf-binaryJames McCoy2025-02-26
|\ | | | | fix(vim_snprintf): special-case handling of binary format
| * fix(vim_snprintf): special-case handling of binary formatJames McCoy2025-02-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A binary format spec always expects a corresponding unsigned long long value. However, that explicit handling didn't get included when porting the code from Vim, so binary format spec was falling through to the "unsigned" and "length_modifier = NUL" portion of the code: } else { // unsigned switch (length_modifier) { case NUL: uarg = (tvs ? (unsigned)tv_nr(tvs, &arg_idx) : (skip_to_arg(ap_types, ap_start, &ap, &arg_idx, &arg_cur, fmt), va_arg(ap, unsigned))); break; This incorrectly read an "unsigned" value from an "unsigned long long" variable, which would produce incorrect results on certain platforms.
* | build(cjson): sync with upstream (#32114)Tristan Knight2025-02-26
| | | | | | | | Sync with commit https://github.com/openresty/lua-cjson/commit/91ca29db9a4a4fd0eedaebcd5d5f3ba2ace5ae63
* | fix(eval): don't shorten $HOME in v:stacktrace (#32634)zeertzjq2025-02-26
| |
* | refactor: remove unnecessary allocation for "run Nvim with -V1" (#32633)zeertzjq2025-02-26
|/
* refactor(options): fix coverity warning about unintialized sc_chan (#32630)zeertzjq2025-02-26
|
* fix(extmark): clearer error message for invalid ephemeral mark usageRiley Bruins2025-02-26
|
* fix(lua): don't override script ID from :source (#32626)zeertzjq2025-02-25
| | | | | | | | Problem: When setting an option, mapping etc. from Lua without -V1, the script ID is set to SID_LUA even if there already is a script ID assigned by :source. Solution: Don't set script ID to SID_LUA if it is already a Lua script. Also add _editor.lua to ignorelist to make script context more useful when using vim.cmd().
* fix(move): wrong cursor row on concealed line (#32629)luukvbaal2025-02-25
| | | | Problem: Cursor row calculation does not take into account concealed lines. Solution: Break the loop when the next calculated line is concealed.
* feat(treesitter): vertical conceal support for highlighterLuuk van Baal2025-02-25
| | | | | | | | TSHighlighter now places marks for conceal_lines metadata. A new internal decor provider callback _on_conceal_line was added that instructs the highlighter to place conceal_lines marks whenever the editor needs to know whether a line is concealed. The bundled markdown queries use conceal_lines metadata to conceal code block fence lines.
* feat(marks): add conceal_lines to nvim_buf_set_extmark()Luuk van Baal2025-02-25
| | | | Implement an extmark property that conceals lines vertically.
* vim-patch:9.1.1145: multi-line completion has wrong indentation for last ↵glepnir2025-02-25
| | | | | | | | | | | | line (#32625) Problem: When expanding omni completion items with newlines (e.g. `then\n\t\nend`), the end statement gets wrong indentation. Solution: Add OPENLINE_FORCE_INDENT flag to make open_line() use second_line_indent directly (glepnir) closes: vim/vim#16614 https://github.com/vim/vim/commit/5090a1fecb86c44be83d55e139ed79b7785fa090
* fix(api): don't override Vimscript SID (#32610)zeertzjq2025-02-25
| | | | | | | | | | Problem: When calling an API from Vimscript to set an option, mapping, etc., :verbose shows that it's set from an API client. Solution: Don't override current_sctx.sc_sid when calling an API from Vimscript. Also fix the inverse case where API channel id is not set when calling an API from RPC. Move channel id into sctx_T to make saving and restoring easier. Related #8329
* fix(lua): SIGSEGV in luv callback with error(nil) #32595phanium2025-02-24
| | | | | | | | | Problem: luv callback `vim.uv.new_timer():start(0, 0, function() error() end)` causes SIGSEGV, since `xstrdup` gets NULL from `lua_tostring`. Similar to: https://github.com/neovim/neovim/commit/a5b1b83a2693ffa7a5a0a22b3693d36ea60051be Solution: Check NULL before `xstrdup`.
* vim-patch:9.1.1143: illegal memory access when putting a register (#32604)zeertzjq2025-02-24
| | | | | | | | Problem: illegal memory access when putting a register Solution: make sure cursor column doesn't become negative https://github.com/vim/vim/commit/e0029daa3599529d9d438cc51c7ada8580297a39 Co-authored-by: Christian Brabandt <cb@256bit.org>
* feat(complete): CompleteDone reason "cancel", "discard" #32600Evgeni Chasnovski2025-02-23
| | | | | | | Problem: there is no way to distinguish between user's explicit completion stop/cancel and other automated reasons. Solution: update "cancel" reason to be set only on explicit CTRL-e, and set intentionally vague "discard" otherwise.