mirror of
https://github.com/neovim/neovim.git
synced 2026-03-28 03:12:00 +00:00
feat(diff): merge adjacent blocks using inline:word (#37085)
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
42c6686c78
This commit is contained in:
5
runtime/lua/vim/_meta/options.lua
generated
5
runtime/lua/vim/_meta/options.lua
generated
@@ -1873,7 +1873,10 @@ vim.go.dex = vim.go.diffexpr
|
||||
--- difference. Non-alphanumeric
|
||||
--- multi-byte characters such as emoji
|
||||
--- and CJK characters are considered
|
||||
--- individual words.
|
||||
--- individual words. Small gaps of
|
||||
--- non-word characters (5 bytes or less)
|
||||
--- between changes are merged into a
|
||||
--- single highlight block.
|
||||
---
|
||||
--- internal Use the internal diff library. This is
|
||||
--- ignored when 'diffexpr' is set. *E960*
|
||||
|
||||
Reference in New Issue
Block a user