Releases: cvlmtg/inline-diff.nvim
Releases · cvlmtg/inline-diff.nvim
Release list
v3.0.0
Breaking changes
None. Public API (setup, enable, disable, toggle, commands) is unchanged.
Performance
Line-level diff now uses Neovim's built-in vim.diff() (C xdiff library) instead of the pure-Lua Myers implementation. Benchmarks on an M4 Pro, Neovim 0.11.6:
| Dataset | Before (Myers) | After (xdiff) |
|---|---|---|
| small/scattered ~200 lines | 0.2 ms | 0.2 ms |
| small/mixed ~400 lines | 5 ms | 3 ms |
| large/scattered ~2000 lines | 8 ms | 1.3 ms |
| large/mixed ~4000 lines | ~180 ms | 34 ms |
The async thread machinery (vim.uv.new_thread, _worker.lua, JSON encode/decode round-trip) is removed — vim.diff is synchronous C code fast enough for all file sizes.
Internal
- Deleted
lua/inline-diff/_worker.lua compute_hunksis now synchronous (callback still called for API compatibility)_myers_matchedis kept for word-level (sub-line) diffing- Added
bench/suite for reproducing the measurements:nvim --headless --clean -c "set rtp+=." -c "luafile bench/run.lua"
v2.3.0
Fixed
- Word-level diff no longer splits multi-byte UTF-8 characters (CJK, accented letters, emoji) across token boundaries. Previously each byte of a multi-byte character was treated as a separate token, which could produce
nvim_buf_set_extmarkcalls with byte offsets landing mid-codepoint, causing garbled highlight rendering.
Tests
74 tests (up from 69); added _tokenize unit tests and multi-byte word-diff coverage
v2.2.0
v2.1.0
Performance
- Myers O(ND) word diff — word-level diff now uses the same Myers algorithm as line diff, replacing the O(m×n) LCS
- Hunk cache — skip extmark clear+rebuild when hunks are unchanged between refreshes (the common case while typing within an existing change)
- Raised sync threshold to 500 lines — files under 500 total lines diff synchronously, avoiding thread serialization overhead for the vast majority of real-world files
decode_linesallocation fix — worker no longer allocates a full copy of the content string to split lines
Fixed
prev_hunkscache correctly invalidated when switching refs, preventing a blank buffer afterrender.clear()
Tests
69 tests (up from 60); added _hunks_equal unit tests and ref-switch invalidation coverage
v2.0.0
Fixed
- Windows:
git showpath spec now uses forward slashes; backslashes inrelpathcaused git to report "path exists on disk but not in HEAD" - Windows:
git showoutput with CRLF line endings no longer leaves trailing\ron every old line, which caused all lines to compare unequal - Thread worker: if
require("inline-diff._worker")fails in the background thread (e.g. due topackage.pathresolution differences), the diff now falls back to synchronous computation on the main thread instead of silently producing no output
Performance
- Diff computation runs off the main thread via
vim.uv.new_thread, keeping the UI responsive on large files
v1.0.0
What's new
Added
[ref]argument on all commands and the Lua API — diff against any git ref per invocation without changing the default (HEAD~1, a branch, a SHA, …)stagedref: diff against the git index (what you'vegit add-ed); falls back toHEADautomatically when the file has no staged content
Fixed
- Auto-scroll now correctly reveals all bottom virtual lines when the last buffer line wraps to more than one visual row
- Auto-scroll no longer crashes when
topline == buf_line_count
Performance
- Removed redundant O(m+n) line-copy in
_diff_lines - LCS dp-table initialization reduced from O(m×n) to O(m+n) by only pre-filling boundary rows/cols
compute_hunksnow delivers results synchronously, saving one event-loop round-trip per keystroke
Tests
- Expanded test suite to 56 tests; added dedicated
scroll_spec.lua
See CHANGELOG.md for the full history.