Commit graph

2 commits

Author SHA1 Message Date
3c3b27a2cb perf: cache repo root and harden async paths
Problem: get_repo_root() shells out on every call, causing 4-6
redundant subprocesses per gdiff_file() invocation.
highlight_vim_syntax() leaks a scratch buffer if nvim_buf_call errors.
lib.ensure() silently drops callbacks during download, permanently
missing intra-line highlights. The debounce timer callback can operate
on an invalid buffer.

Solution: Cache get_repo_root() results by parent directory. Wrap
nvim_buf_call and nvim_buf_delete in pcall so the scratch buffer is
always cleaned up. Queue pending callbacks in lib.ensure() so all
callers receive the handle once the download completes. Guard the
debounce timer callback with nvim_buf_is_valid.
2026-02-09 12:36:51 -05:00
997bc49f8b feat(highlight): add character-level intra-line diff highlighting
Line-level backgrounds (DiffsAdd/DiffsDelete) now get a second tier:
changed characters within modified lines receive an intense background
overlay (DiffsAddText/DiffsDeleteText at 70% alpha vs 40% for lines).
Treesitter foreground colors show through since the extmarks only set bg.

diff.lua extracts contiguous -/+ change groups from hunk lines and diffs
each group byte-by-byte using vim.diff(). An optional libvscodediff FFI
backend (lib.lua) auto-downloads the .so from codediff.nvim releases and
falls back to native if unavailable.

New config: highlights.intra.{enabled, algorithm, max_lines}. Gated by
max_lines (default 200) to avoid stalling on huge hunks. Priority 201
sits above treesitter (200) so the character bg always wins.

Closes #60
2026-02-06 13:53:58 -05:00