DyeVim icon indicating copy to clipboard operation
DyeVim copied to clipboard

Error with split windows

Open real-or-random opened this issue 6 years ago • 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.)

real-or-random avatar May 18 '18 21:05 real-or-random

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 https://github.com/davits/DyeVim/blob/b915e4ddc3d9b4b5365ce264ce1e7c1b13281915/python/dye/dyevim.py#L70 Please give it a try, meanwhile I'll see if there is a better solution.

davits avatar May 21 '18 12:05 davits

That change fixes the problem.

real-or-random avatar May 21 '18 15:05 real-or-random