Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YCM hover popup causes NERDTree pane to misbehave #384

Open
josephpei opened this issue Feb 26, 2021 · 4 comments
Open

YCM hover popup causes NERDTree pane to misbehave #384

josephpei opened this issue Feb 26, 2021 · 4 comments

Comments

@josephpei
Copy link

josephpei commented Feb 26, 2021

ubuntu 20.04, vim 8.1, nerdtree, vim-devicons, ycm + clangd
ycm-core/YouCompleteMe#3848
https://user-images.githubusercontent.com/14184522/107708879-de403000-6c89-11eb-9dbe-c7bd7e3d5a0e.mov

If disable vim-devicons, everything is normal.
If enable vim-devicons, when the cursor in nerdtree window on the top line, behavere is normal.
When the cursor in nerdtree window on other line, then back to code window, when ycm hover popup window shows, nerdtree window will only display lines below the old cursor.

@adelejjeh
Copy link

@josephpei Thanks for opening this issue. I was going to do that as well.

I'm having the same problem. Please see original issue I opened in YCM repo (linked in @josephpei's comment above). It seems that the issue is coming from vim-devicons and not from YCM.

@puremourning
Copy link

The issue occurs do to the use of setbufvar() on a popup window.

Steps to reproduce, as this issue doesn't have any:

  1. mkdir test
  2. git clone https://github.com/ryanoasis/vim-devicons
  3. git clone https://github.com/preservim/nerdtree
  4. put below following in a file named 'test.vim'
  5. vim -Nu test.vim test.vim
  6. :NERDTree
  7. move to nerd tree window and expand things with <CR> until the screen is full, then G to go to bottom. ctrl-w w to go back to the .vim file
  8. G to go to the end
  9. wait 4 seconds for CursorHold to trigger

actual result: the NERDTree window scrolls unexpectedly when the popup is shown.

" Load nerdtree and vim-devicons (only)
let wd = expand( '<sfile>:p:h' )

let nerd = wd . '/nerdtree'
let icons = wd . '/vim-devicons'

let &rtp .= ',' . nerd . ',' . icons
filetype plugin indent on
syn on


let s:p = -1
let s:t = -1

function! s:Callback( ... )
  call popup_hide( s:p )

  let s:p = popup_atcursor( [ 'test' ], {
        \   'fixed': 0,
        \   'close': 'click',
        \   'moved': 'word'
        \ } )

  call setbufvar( winbufnr( s:p ), '&syntax', 'cpp' )
endfunction


function! s:DoAPopup() abort
  call timer_stop( s:t )
  let s:t = timer_start( 250, function( 's:Callback' ) )
endfunction

augroup TEST
  autocmd! * <buffer>
  autocmd CursorHold <buffer> call s:DoAPopup()
augroup END

NOTE if removing the setbufvar() in s:Callback, the issue does not occur.

@puremourning
Copy link

incidentally, changing setbufvar() to win_execute( s:p, 'setlocal syntax=cpp' ) also doesn't have the problem

@ozthekoder
Copy link

I am having the same issue with CoC hover popups as well. Any updates on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants