brenoprata10 / nvim-highlight-colors

Highlight colors for neovim
654 stars 31 forks source link

whenever I switch the buffer, the highlight colors are gone #73

Closed sergiornelas closed 5 months ago

sergiornelas commented 5 months ago

If I change the buffer using for example <c-^>, and return back, the highlight colors dissappears:

image image
brenoprata10 commented 5 months ago

Hey o/ Thanks for reporting the issue. I've investigated this bug and I recommend opening an issue in neovim instead. Here is what is happening:

  1. My plugin is receiving the buffer id from the autocmd callback;
  2. I fetch the window id for the buffer with vim.fn.bufwinid;
  3. I call nvim_win_call with the window id and then I fetch the start and end line of the current window with vim.fn.line('w0') and vim.fn.line(w$);
  4. When triggering <c-^>, neovim returns 1 for both vim.fn.line calls, which obviously will not highlight anything.

This is definetely a neovim bug which is not returning the correct values when calling vim.fn.line. I will be closing this issue since there is nothing I can do on my side to fix this.