liuchengxu / vista.vim

:cactus: Viewer & Finder for LSP symbols and tags
https://liuchengxu.github.io/vista.vim
MIT License
1.88k stars 89 forks source link

vista tries to scroll wrong window #394

Closed vatosarmat closed 3 years ago

vatosarmat commented 3 years ago

Describe the bug

  1. Configure cursor strategy to 'scroll' and cursor position to left. Open Vista coc to the left of the source window, press j several times, see how vista side window flickers trying to scroll itself.
  2. Configure cursor strategy to 'scroll'. Open Vista coc to the right of the source window. Then open coc-explorer, then return focus to 'Vista'. Press 'j' several times, see how vista scrolls 'coc-explorer' instead of the source window.

Environment:

Vista info let g:vista_sidebar_position = 'vertical topleft' let g:vista_sidebar_width = 60 let g:vista_cursor_delay = 0 let g:vista_echo_cursor_strategy = 'scroll'

winnr is a volatile value. Why does Vista use it and not buf_id and win_id to identify window when scrolling? This fixes the issue

   let source_handle = {}

   function! source_handle.get_winnr() abort
-    if has_key(self, 'winnr')
-      return self.winnr
-    else
       return bufwinnr(self.bufnr)
-    endif
   endfunction

vista