davits/DyeVim

Error with split windows

Opened this issue · 2 comments

  1. Open file supported by DyeVim
  2. Split the window
  3. Scroll 1 tick up and 1 tick down with scroll wheel in new window

Result:

Error detected while processing function <SNR>151_OnCursorMoved:
line    1:
  File "<string>", line 1, in <module>
  File "/home/tim/.config/haskell-vim-now/.vim/bundle/DyeVim/autoload/../python/dye/dyevim.py", line 66, in OnCursorMoved
    self._windows[ self._GetCurrentWId() ].OnCursorMoved()
  File "/home/tim/.config/haskell-vim-now/.vim/bundle/DyeVim/autoload/../python/dye/window.py", line 75, in OnCursorMoved
    self.OnViewportChanged( current )
  File "/home/tim/.config/haskell-vim-now/.vim/bundle/DyeVim/autoload/../python/dye/window.py", line 87, in OnViewportChanged
    self._CreateMatchesForInterval( view )
  File "/home/tim/.config/haskell-vim-now/.vim/bundle/DyeVim/autoload/../python/dye/window.py", line 57, in _CreateMatchesForInterval
    for sr in self._buffer.GetSkippedRanges( view ):
  File "/home/tim/.config/haskell-vim-now/.vim/bundle/DyeVim/autoload/../python/dye/buffer.py", line 81, in GetSkippedRanges
    self._QuerySkippedRanges()
  File "/home/tim/.config/haskell-vim-now/.vim/bundle/DyeVim/autoload/../python/dye/buffer.py", line 90, in _QuerySkippedRanges
    self._timeout )
  File "/home/tim/.config/haskell-vim-now/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 649, in GetSkippedRanges
    buffer = vim.buffers[ bufnr ]
ValueError: number must be greater than zero  

(Other cursor moves in step 3 yield essentially the same result but then the stack trace is output line by line.)

The problem is that on :split command OnBufEnter autocmd is not called, since the buffer is the same.
The problem is solved by adding call self.OnBufferEnter() in the OnWindowEnter() function after this line

self._SetCurrentWId()

Please give it a try, meanwhile I'll see if there is a better solution.

That change fixes the problem.