aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/diff.c
Commit message (Collapse)AuthorAge
* vim-patch:9.2.1026: heap-use-after-free via DiffUpdated autocommand (#42238)Jan Edmund Lazo2026-10-05
| | | | | | | | | | | | Problem: A DiffUpdated autococmd wiping the current buffer can cause a use-after-free (Evaopo). Solution: Disallow changing the window layout while DiffUpdated autocommand runs. closes: vim/vim#21177 https://github.com/vim/vim/commit/d81720e01a7ce79afa2c55aff5270d9f394ccbbe Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.2.1151: reading before the linemap array with inline:word diffzeertzjq2026-09-30
| | | | | | | | | | | | | | Problem: diff_refine_inline_word_highlight() checks the index of the line after the block, but uses the index of the last line of the block. A block with zero lines makes the index negative and causes heap-buffer underflow (Yuyao Jiang). Solution: Check that the indexes are not negative. related: vim/vim#21373 https://github.com/vim/vim/commit/f84ab19890c467fe2d1c001494e996178ece6e11 Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.2.1099: diff mode redraws slowly with many changes (#41906)zeertzjq2026-09-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Redrawing or folding a diff with many changes is slow because for every screen line the list of diff blocks is scanned from the start. Solution: Remember the last examined diff block and resume the scan from there while the line number does not move backwards (Julien Voisin). This change is similar to v9.2.1042 (5feaa6c6c201d4d05b833a7230d07da44bf2504b) and v9.2.1036 (f1b454912996d6417acd0d738de0eb7b60902c56) quadratic behaviour replaced with a linear one by keeping track of previous ordered insertions. diff_check_with_linestatus() and diff_infold() are called for every line during redraw and fold updates, with a line number that usually increases monotonically, yet each restarted its scan at tp_first_diff. A cursor into the block list is now kept and cleared whenever a block is freed, allocated or has its line numbers shifted, so the next call continues where the previous one stopped. Scanning the diff blocks during a scroll of a 20000-line diff drops from 4.12G to 1.27G instructions with ~3300 changes, and scales with the number of changes. Tests were added as the change is non-trivial. closes: vim/vim#21256 https://github.com/vim/vim/commit/2ec2a612c7ac9315a17d70f6a2a5ea89ddaea854 Co-authored-by: Julien Voisin <julien.voisin@dustri.org>
* vim-patch:9.2.0914: diff: undo after :diffget into an empty buffer leaves a ↵zeertzjq2026-08-06
| | | | | | | | | | | | | | | | | | line behind (#41181) Problem: After :diffget into an empty buffer, undo does not restore the empty buffer, the last line stays behind (Narendran Gopalakrishnan) Solution: Include the empty line of the empty buffer in the undo information, it is deleted once the first line was obtained (Hirohito Higashi). fixes: vim/vim#20950 closes: vim/vim#20951 https://github.com/vim/vim/commit/c44f35ca1a4d8c0c78f327800fe2677c91c6cecb Co-authored-by: Hirohito Higashi <h.east.727@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feat(options): lua closure/function optionsJustin M. Keyes2026-07-31
| | | | | | | | | | | | | | | Problem: Cannot assign Lua functions/closures to "func" ('completefunc', 'tagfun', …) or "expr" ('foldexpr', 'indentexpr', …) options. Solution: - Store "func"/"expr" options as `Callback` instead of string. - Delete oceans of copy-pasted code. - BREAKING: LuaRef returned via RPC/Vimscript is now represented as `"<Lua N: file:line>"` (like what `:map` shows) instead of `nil`. - Note: `man.vim` still uses `v:lua` string, bc it's a vimscript ftplugin. Helped-by: Lewis Russell <lewis6991@gmail.com>
* refactor(options): drop OptVal, use ObjectJustin M. Keyes2026-07-29
| | | | | | | | | | | | | Problem: The object subsystem has an intermediate representation for no real reason. Besides the code cost, this also adds an extra (api <=> OptVal) conversion step, which is a (small) perf cost. Solution: We already have `Object`, so use it instead. - drop `OptVal`, `OptValData`, `OptValType`, and related boilerplate. - add `kObjectTypeUnset`.
* perf(options): no-alloc keysetsJustin M. Keyes2026-07-24
|
* refactor(options): store dict options in :set-string formJustin M. Keyes2026-07-24
| | | | | | | | | | The parent commit made a valiant effort to store "dict options" in their reified form, but this is more trouble than it's worth: - inconsistent model for developers to understand. - string lifetime issues (the "varp" convention is to pass around an aliased, long-lived option value). - lots of extra plumbing to deal with the 2 different option-storage paradigms.
* feat(options): schema, "dict" options, messagesJustin M. Keyes2026-07-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Options parsing is still painful for dict-style options. Solution: schema-maxxing => better `opt:get()` (will be the basis for `vim.o()`), unified (and more-detailed) err msgs. - Drop bespoke structure-builder in `_core/options.lua`. - Define `schema` for all non-primitive options (except 'guicursor' and statusline-style options); generate reified keysets `OptKeyDict`). - Generate 'fillchars' => `fcs_tab`, 'listchars' => `lcs_tab`. - `nvim_set_option_value`: - Return the improved structures. Also from `vim.opt.x:get()`. - Eliminate api <=> lua roundtrip, centralize option structure handling. - Improve/unify errors. - Bump ERR_BUFLEN 80 → 256 so the "one of" list isn't truncated. - Eliminate old 'diffopt' order-dependence (`iwhiteall` before `iwhite`) Error samples: Typed-key path (opt_strings_check → diffopt/mousescroll/breakindentopt): E474: Unknown item 'foo' E474: 'context' requires a number E474: 'ver' number is out of range E474: 'algorithm' must be one of: myers, minimal, patience, histogram E474: 'filler' does not take a value Related: - #31084 - #34661 - #31820 - #14739 - #20107 - fix #18875 - :get() returns `{ sbr = true, shift = '3' }` (reified-keyset) instead of `{'sbr', 'shift:3'}` - Setting via table now works too. `object_as_optval_for` `is_map` now recognizes struct options. - fix #30296 - instead of `E474: Invalid argument`, errors now look like: ``` E474: Invalid value 'x', expected one of: single, double: ambiwidth=x E474: Unknown item 'foo': diffopt=foo E474: 'context' requires a number: diffopt=context:x ``` simplify `win_float_parse_option` from #26799.
* refactor(ctx): drop aucmd_prepbuf/aucmd_restbuf #40692Justin M. Keyes2026-07-11
|
* fix(diff): resource leak on :diffput E787 error path #40686Justin M. Keyes2026-07-11
| | | Coverity CID 649080/649081
* refactor: simplify aucmd_restbuf usage #39879Justin M. Keyes2026-05-19
| | | | | | | | Problem: `aucmd_restbuf` must be guarded in case `aucmd_prepbuf` wasn't called. Solution: Update `aucmd_restbuf` to be a no-op if `aucmd_prepbuf` wasn't called. This requires `aco` to be zero-initialized.
* feat(diff): merge adjacent blocks using inline:word (#37085)Harsh Kapse2026-03-17
| | | | | | | | | | | | | | | | | | | | | vim-patch:9.2.0174: diff: inline word-diffs can be fragmented Problem: When using 'diffopt=inline:word', lines were excessively fragmented with punctuation creating separate highlight blocks, making it harder to read the diffs. Solution: Added 'diff_refine_inline_word_highlight()' to merge adjacent diff blocks that are separated by small gaps of non-word characters (up to 5 bytes by default) (HarshK97). When using inline:word diff mode, adjacent changed words separated by punctuation or whitespace are now merged into a single highlight block if the gap between them contains fewer than 5 non-word characters. This creates more readable diffs and closely matches GitHub's own diff display. closes: vim/vim#19098 https://github.com/vim/vim/commit/42c6686c78d39843f71dba989a8ea59bc6975132
* vim-patch:9.1.2118: 'cursorline' missing after :diffput to empty buf (#37628)zeertzjq2026-01-30
| | | | | | | | | | | Problem: 'cursorline' and part of 'statusline' are missing after :diffput to an empty buffer. Solution: Make sure the cursor doesn't go beyond the last line after :diffput (zeertzjq) related: neovim/neovim#37621 closes: vim/vim#19281 https://github.com/vim/vim/commit/ce1e562fdafa998e577d65a8b0a1b8bc1cbfcf4c
* vim-patch:9.1.2085: Use-after-free in winframe_remove()zeertzjq2026-01-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Use-after-free in winframe_remove() (henices) Solution: Set window_layout_locked() inside winframe_remove() and check that writing diff files is disallowed when the window layout is locked. It can happen with a custom diff expression when removing a window: 1. Buffer was removed, so win_frame_remove() is called to remove the window. 2. win_frame_remove() → frame_new_height() → scroll_to_fraction() → diff_check_fill() (checks for filler lines) 3. diff_check_fill() ends up causing a diff_try_update, and because we are not using internal diff, it has to first write the file to a buffer using buf_write() 4. buf_write() is called for a buffer that is not contained within a window, so it first calls aucmd_prepbuf() to create a new temporary window before writing the buffer and then later calls aucmd_restbuf(), which restores the previous window layout, calling winframe_remove() again, which will free the window/frame structure, eventually freeing stuff that will still be accessed at step 2. closes: vim/vim#19064 https://github.com/vim/vim/commit/ead1dda74a485ef0470e7252d07c1a36b8cde517 Nvim doesn't have this bug as Nvim uses a floating window as autocommand window, and removing it doesn't need winframe_remove(). Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.1.2078: A few more typos in various files (#37368)zeertzjq2026-01-12
| | | | | | | | | | | Problem: A few more typos in various files Solution: Fix those (zeertzjq, antonkesy) related: neovim/neovim#37348 closes: vim/vim#19153 https://github.com/vim/vim/commit/6a2b5b2246833f7922e38eabab7090e29e89c3a1 Co-authored-by: Anton Kesy <anton@kesy.de>
* vim-patch:8.1.0753: printf format not checked for semsg() (#37248)zeertzjq2026-01-05
| | | | | | | | | | | Problem: printf format not checked for semsg(). Solution: Add GNUC attribute and fix reported problems. (Dominique Pelle, closes vim/vim#3805) https://github.com/vim/vim/commit/b5443cc46dd1485d6c785dd8c65a2c07bd5a17f3 Cherry-pick a change from patch 8.2.3830. Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:8.2.2198: ml_get error when resizing window and using text propertyJan Edmund Lazo2026-01-01
| | | | | | | | | | | | | | | Problem: ml_get error when resizing window and using text property. Solution: Validate botline of the right window. (closes vim/vim#7528) https://github.com/vim/vim/commit/23999d799cfe844b604f193183f8f84052c8e746 Migrate to Vim's (in)validate_botline_win() API. Nvim wants to pass "curwin" instead of hiding them behind alias/macro/inline-function. https://github.com/neovim/neovim/pull/37164#discussion_r2655006908 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:9.1.1963: diff: missing diff size limit for xdiff (#36877)zeertzjq2025-12-09
| | | | | | | | | | | | | | | | | | | | | | | Problem: diff: missing diff size limit for xdiff Solution: Impose file size limit for internal diff (xdiff) (Yee Cheng Chin). Git imposes a hard cap on file size for content that it passes to xdiff (added to Git in dcd1742e56e, defined in xdiff-interface.h), due to integer overflow concerns in xdiff. Vim doesn't specify such a limit right now, which means it's possible for a user to diff a large file (1GB+) and trigger these overflow issues. Add the same size limit (1GB minus 1MB) to Vim and simply throws an error when Vim encounters files larger than said limit. For now, reuse the same error message regarding internal diff failures. There is no need to add the same limit for external diff as it's up to each tool to error check their input to decide what is appropriate or not. closes: vim/vim#18891 https://github.com/vim/vim/commit/4af6d9755cba0dd07e881172f2a6e0efe9986ddc Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:8.1.1957: more code can be moved to evalvars.cJan Edmund Lazo2025-10-05
| | | | | | | | | | Problem: More code can be moved to evalvars.c. Solution: Move code to where it fits better. (Yegappan Lakshmanan, closes vim/vim#4883) https://github.com/vim/vim/commit/da6c03342117fb7f4a8110bd9e8627b612a05a64 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:9.1.1823: diff: w_topline may be invalidated (#36018)zeertzjq2025-10-04
| | | | | | | | | | | | | | | | | Problem: diff: w_topline may be invalidated Solution: Update lnum in diff_set_topline() (Yee Cheng Chin). This can happen in ex_diffupdate() for certain edge cases which cause the logic to now be wrong. This was also the root cause for vim/vim#18437 where Vim would crash due to a null pointer dereferencing (said pointer would not be null under normal circumstances). related: vim/vim#18437 closes: vim/vim#18484 https://github.com/vim/vim/commit/dd9ed46a39df8a8b08ef4b491fdf53bcbfdc0c2d Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:9.1.1818: possible crash when calculating topline in diff.czeertzjq2025-10-02
| | | | | | | | | | | | | | Problem: possible crash when calculating topline in diff.c (youngmith) Solution: Check for pointer being Null before accessing it fixes: vim/vim#18437 https://github.com/vim/vim/commit/d32b3bb7ebe29f856a054cfd552c68afabd065c3 The POC is likely not applicable to Nvim due to #32160. Co-authored-by: Christian Brabandt <cb@256bit.org>
* vim-patch:9.1.1758: Diff mode crashes when adding text property in ↵zeertzjq2025-09-15
| | | | | | | | | | | | | autocommand (#35760) Problem: Diff mode crashes when adding text property in autocommand (after 9.1.1557). Solution: Only restore ML_EMPTY memline flag, ignore the others (zeertzjq). fixes: vim/vim#18288 closes: vim/vim#18291 https://github.com/vim/vim/commit/46e22fd2f73b03795a5922ba07621472713eddb3
* vim-patch:9.1.1753: defaults: 'diffopt' option value can be improved (#35727)zeertzjq2025-09-12
| | | | | | | | | | | | | | | | | | | | | | | Problem: defaults: 'diffopt' option value can be improved Solution: Update diffopt defaults to include "indent-heuristic" and "inline:char" (Yee Cheng Chin) The default diff options have not been updated much despite new functionality having been added to Vim. - indent-heurstic: This has been enabled by default in Git since 33de716387 in 2017. Given that Vim uses xdiff from Git, it makes sense to track the default configuration from Git. - inline:char: This turns on character-wise inline highlighting which is generally much better than the default inline:simple. It has been implemented since vim/vim#16881 and we have not seen reports of any issues with it, and it has received good feedbacks. closes: vim/vim#18255 https://github.com/vim/vim/commit/976b365305c2e9025813ff3c7fe52f8d927fafc3 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* fix(diff): set default diff flags properly (#35450)zeertzjq2025-08-24
|
* vim-patch:8.2.0853: ml_delete() often called with FALSE argumentJan Edmund Lazo2025-08-20
| | | | | | | | | Problem: ml_delete() often called with FALSE argument. Solution: Use ml_delete_flags(x, ML_DEL_MESSAGE) when argument is TRUE. https://github.com/vim/vim/commit/ca70c07b72c24aae3d141e67d08f50361f051af5 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guardsbfredl2025-08-14
| | | | | | | | | These are not needed after #35129 but making uncrustify still play nice with them was a bit tricky. Unfortunately `uncrustify --update-config-with-doc` breaks strings with backslashes. This issue has been reported upstream, and in the meanwhile auto-update on every single run has been disabled.
* vim-patch:9.1.1600: using diff anchors with hidden buffers fails silently ↵zeertzjq2025-08-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | (#35218) Problem: diff: using diff anchors with hidden buffers fails silently Solution: Give specific error message for diff anchors when using hidden buffers (Yee Cheng Chin). Diff anchors currently will fail to parse if a buffer used for diff'ing is hidden. Previously it would just fail as the code assumes it would not happen normally, but this is actually possible to do if `closeoff` and `hideoff` are not set in diffopt. Git's default diff tool "vimdiff3" also takes advantage of this. This fix this properly would require the `{address}` parser to be smarter about whether a particular address relies on window position or not (e.g. the `'.` address requires an active window, but `'a` or `1234` do not). Since hidden diff buffers seem relatively niche, just provide a better error message / documentation for now. This could be improved later if there's a demand for it. related: vim/vim#17615 closes: vim/vim#17904 https://github.com/vim/vim/commit/cad3b2421de7b703e0ee619850a8a3bc55454281 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:9.1.1567: crash when using inline diff mode (#35005)zeertzjq2025-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | Problem: Crash when using inline diff mode (Ilya Grigoriev) Solution: Set tp_diffbuf to NULL when skipping a diff block (Yee Cheng Chin). Fix an array out of bounds crash when using diffopt+=inline:char when 4 or more buffers are being diff'ed. This happens when one of the blocks is empty. The inline highlight logic skips using that buffer's block, but when another buffer is used later and calls diff_read() to merge the diff blocks together, it could erroneously consider the empty block's diff info which has not been initialized, leaving to diff numbers that are invalid. Later on the diff num is used without bounds checking which leads to the crash. Fix this by making sure to unset tp_diffbuf to NULL when we skip a block, so diff_read() will not consider this buffer to be used within inline diff. Also, add more bounds checking just to be safe. closes: vim/vim#17805 https://github.com/vim/vim/commit/c8b99e2d139cf72c567892e44939f2719f703fa8 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:9.1.1557: not possible to anchor specific lines in diff mode (#34967)zeertzjq2025-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: not possible to anchor specific lines in diff mode Solution: Add support for the anchoring lines in diff mode using the 'diffanchor' option (Yee Cheng Chin). Adds support for anchoring specific lines to each other while viewing a diff. While lines are anchored, they are guaranteed to be aligned to each other in a diff view, allowing the user to control and inform the diff algorithm what the desired alignment is. Internally, this is done by splitting up the buffer at each anchor and run the diff algorithm on each split section separately, and then merge the results back for a logically consistent diff result. To do this, add a new "diffanchors" option that takes a list of `{address}`, and a new "diffopt" option value "anchor". Each address specified will be an anchor, and the user can choose to use any type of address, including marks, line numbers, or pattern search. Anchors are sorted by line number in each file, and it's possible to have multiple anchors on the same line (this is useful when doing multi-buffer diff). Update documentation to provide examples. This is similar to Git diff's `--anchored` flag. Other diff tools like Meld/Araxis Merge also have similar features (called "synchronization points" or "synchronization links"). We are not using Git/Xdiff's `--anchored` implementation here because it has a very limited API (it requires usage of the Patience algorithm, and can only anchor unique lines that are the same across both files). Because the user could anchor anywhere, diff anchors could result in adjacent diff blocks (one block is directly touching another without a gap), if there is a change right above the anchor point. We don't want to merge these diff blocks because we want to line up the change at the anchor. Adjacent diff blocks were first allowed when linematch was added, but the existing code had a lot of branched paths where line-matched diff blocks were handled differently. As a part of this change, refactor them to have a more unified code path that is generalized enough to handle adjacent diff blocks correctly and without needing to carve in exceptions all over the place. closes: vim/vim#17615 https://github.com/vim/vim/commit/0d9160e11ce4b921adff1e5621dd989ce96fb0f3 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:9.1.1473: inconsistent range arg for :diffget/diffput (#34588)zeertzjq2025-06-22
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: inconsistent range arg for :diffget/diffput Solution: fix the range specification, place the cursor for :diffput and :diffget consistently on the last line (Yee Cheng Chin) Previously, `:<range>diffget` only allowed using 1 or above in the range value, making it impossible to use the command for a diff block at the beginning of the file. Fix the range specification so the user can now use 0 to specify the space before the first line. This allows `:0,$+1diffget` to work to retrieve all the changes from the other file instead of missing the first diff block. Also do this for `:diffput`. Also, make `:diffput` work more similar to `:diffget`. Make it so that if the cursor is on the last line and a new line is inserted in the other file, doing `:diffput` will select that diff block below the line, just like `:diffget` would. Also clean up the logic a little bit for edge cases and for handling line matched diff blocks better. closes: vim/vim#17579 https://github.com/vim/vim/commit/d75ab0cbf5cfaefab3edb0aa553954de70b236f8 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:9.1.1439: Last diff folds not merged (#34380)zeertzjq2025-06-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Last diff folds not merged (after v8.1.1922) Solution: loop over all windows in the current tabpage and update all folds (Gary Johnson) This commit fixes a bug where the last two folds of a diff are not merged when the last difference between the two diff'd buffers is resolved. Normally, when two buffers are diff'd, folding is used to show only the text that differs and to hide the text that is the same between the two buffers. When a difference is resolved by making a block of text the same in both buffers, the folds are updated to merge that block with the folds above and below it into one closed fold. That updating of the folds did not occur when the block of text was the last diff block in the buffers. The bug was introduced by this patch on August 24, 2019: patch 8.1.1922: in diff mode global operations can be very slow Problem: In diff mode global operations can be very slow. Solution: Do not call diff_redraw() many times, call it once when redrawing. And also don't update folds multiple times. Unfortunately, folds were then not updated often enough. The problem was fixed by adding a short loop to the ex_diffgetput() function in diff.c to update all the folds in the current tab when the last difference is removed. A test for this was added to test_diffmode.vim. Two of the reference screen dumps for another test in that file, Test_diffget_diffput_linematch(), had to be changed to have all the folds closed rather than to have the last diff block remain open. closes: vim/vim#17457 https://github.com/vim/vim/commit/3fa0d3514b928e0b21ef24594785f9104a3ffafd Co-authored-by: Gary Johnson <garyjohn@spocom.com>
* fix(diff): fix incorrect item size of dout_ga (#34338)zeertzjq2025-06-06
| | | Related https://github.com/neovim/neovim/commit/267494151bcc6e4fff7b9b8c80b7a5f42e2aa002
* vim-patch:9.1.1319: Various typos in the code, issue with ↵zeertzjq2025-04-19
| | | | | | | | | | | | | | test_inst_complete.vim (#33527) Problem: Various typos in the code, redundant and strange use of :execute in test_ins_complete.vim (after 9.1.1315). Solution: Fix typos in the code and in the documentation, use the executed command directly (zeertzjq). closes: vim/vim#17143 https://github.com/vim/vim/commit/98800979dc109e03f390a0472b14ed89189e02fe Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
* fix(env.c): drop envmap, free os_getenv() result #32683Judit Novak2025-04-16
| | | | | | | | | | | | | | | | | | | | | | Problem: vim.uv.os_setenv gets "stuck" per-key. #32550 Caused by the internal `envmap` cache. #7920 :echo $FOO <-- prints nothing :lua vim.uv.os_setenv("FOO", "bar") :echo $FOO <-- prints bar (as expected) :lua vim.uv.os_setenv("FOO", "fizz") :echo $FOO <-- prints bar, still (not expected. Should be "fizz") :lua vim.uv.os_unsetenv("FOO") :echo $FOO <-- prints bar, still (not expected. Should be nothing) :lua vim.uv.os_setenv("FOO", "buzz") :echo $FOO <-- prints bar, still (not expected. Should be "buzz") Solution: - Remove the `envmap` cache. - Callers to `os_getenv` must free the result. - Update all call-sites. - Introduce `os_getenv_noalloc`. - Extend `os_env_exists()` the `nonempty` parameter.
* 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>
* refactor(diff): remove unreachable code (#33149)zeertzjq2025-03-29
|
* vim-patch:9.1.1246: coverity complains about some changes in v9.1.1243zeertzjq2025-03-28
| | | | | | | | | | | Problem: coverity complains about some changes in v9.1.1243 Solution: remove duplicate code in diff_find_changed() (Yee Cheng Chin) closes: vim/vim#16988 https://github.com/vim/vim/commit/4f9b1243e3ef60b9efb64a4e789c55be3cdc7a25 Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:9.1.1243: diff mode is lacking for changes within lineszeertzjq2025-03-28
| | |