vim-highlightedyank
vim-highlightedyank copied to clipboard
A bug on matchdelete (E802: Invalid ID: -1)
I have no idea how to always reproduce it, but pretty often I run into the following error:
Error detected while processing function <SNR>247__doautocmd[7]..356[7]..<SNR>247__supercall[1]..350[3]..376[10]..378:
line 3:
E802: Invalid ID: -1 (must be greater than or equal to 1)
E802 is when matchdelete(v:val)
receives an invalid argument (i.e. v:val = -1
).
System information: Linux/Mac (both), neovim 0.4.3 (and on the latest nightly as well).
In the s:highlight._quench_now()
function (See this file):
call map(self.id, 'matchdelete(v:val)')
call filter(self.id, 'v:val > 0')
Shouldn't we first filter self.id
and then call matchdelete
?
Another similar error that might happen from matchdelete()
:
Error detected while processing function <SNR>252_quench[5]..337:
line 8:
E803: ID not found: 7
Hello, thank you for your report. I've tried on neovim v0.4.3, but unfortunately, I couldn't reproduce. It's easy to fiter ids equal to -1 before passing to matchdelete
, however, in principle, it shouldn't happen. It seems something unexpected happened there. How often does this error happen? Could you make a minimum working vimrc?
I also failed to come up with a minimal vimrc such that it can be consistently reproducible. I suspect there might be a conflict with other plugins, but no idea which one is in conflict. Do you have any other suggestion about how I can debug the plugin when the bug happens? On average, I experience this at least once a day.
Thank you, don't mind about minimal vimrc. Is this your rc files?
I might find the problem. Some plugins use clearmatches() which clears ALL highlights including others set. Probably, vim-highlightedyank tried to clear the highlight which was already cleared, and thus some inconsistency arose in internal states.
(I think plugin should not use the function since it affects globally, only be allowed manually or in tests.)
I've added a check to avoid the above situation. It is already merged to master, please try. Please inform me if the problem still persists.
By the way,
Another similar error that might happen from
matchdelete()
:Error detected while processing function <SNR>252_quench[5]..337: line 8: E803: ID not found: 7
this is probably from another plugin, maybe highlightedundo, I will update it, too. Thank you for using!