vim-better-whitespace icon indicating copy to clipboard operation
vim-better-whitespace copied to clipboard

Error is silently logged when new window is opened

Open EtiamNullam opened this issue 2 years ago • 3 comments

Error

Error detected while processing function <SNR>55_SetupAutoCommands[30]..<SNR>55_ClearHighlighting:
line    1:
E803: ID not found: 4

Steps to reproduce

  1. Install/activate this plugin
  2. :redir @a
  3. :new (:split also works)
  4. "ap

Specs

Windows 10 NVIM v0.5.0 - v0.8.0 (nightly)

EtiamNullam avatar Jun 26 '22 21:06 EtiamNullam

Interesting. I can reproduce on vim 8.2 with a slightly different message:

Error detected while processing WinEnter Autocommands for "*"..function <SNR>43_SetupAutoCommands[11]..<SNR>43_HighlightEOLWhitespace[1]..<SNR>43_ClearHighlighting:
line    1:
E803: ID not found: 4

Cimbali avatar Jun 29 '22 13:06 Cimbali

Actually that is an intentionally silenced message:

https://github.com/ntpeters/vim-better-whitespace/blob/c5afbe91d29c5e3be81d5125ddcdc276fd1f1322/plugin/better-whitespace.vim#L190-L192

I did not know that silenced messages appeared in redirected output. If you start vim with vim --cmd "redir @" you’ll see that we also silence an error on opening vim. In any case there’s 2 tiny issues here:

  • we use s: for the match ID but these ids are bound to windows, hence in a new window the existing id do not make sense
  • matchdelete does not accept -1

Cimbali avatar Jun 29 '22 14:06 Cimbali

Reopening per #154

ntpeters avatar Jun 30 '22 06:06 ntpeters