mirror of
https://github.com/neovim/neovim.git
synced 2026-05-04 13:05:05 +00:00
vim-patch:9.1.1600: using diff anchors with hidden buffers fails silently (#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
cad3b2421d
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
This commit is contained in:
2
runtime/lua/vim/_meta/options.lua
generated
2
runtime/lua/vim/_meta/options.lua
generated
@@ -1736,6 +1736,8 @@ vim.wo.diff = vim.o.diff
|
||||
--- If some of the {address} do not resolve to a line in each buffer (e.g.
|
||||
--- a pattern search that does not match anything), none of the anchors
|
||||
--- will be used.
|
||||
--- *E1562*
|
||||
--- Diff anchors can only be used when there are no hidden diff buffers.
|
||||
---
|
||||
--- @type string
|
||||
vim.o.diffanchors = ""
|
||||
|
||||
Reference in New Issue
Block a user