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

Vim window become blank after resize when which-key is active #27

Open
jiaming-shi opened this issue Dec 31, 2018 · 4 comments
Open

Vim window become blank after resize when which-key is active #27

jiaming-shi opened this issue Dec 31, 2018 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jiaming-shi
Copy link

  • OS: Ubuntu 18.04

  • Vim: Neovim 0.3.1

If you think it's a bug, please provide a minimal vimrc to reproduce:

call plug#begin('~/.config/nvim/plugged')
Plug 'liuchengxu/vim-which-key', { 'on': ['WhichKey', 'WhichKey!'] }
call plug#end()

let mapleader = ' '
let maplocalleader = '\'

augroup vimrc
  autocmd!
  autocmd! User vim-which-key call which_key#register('<Space>', 'g:which_key_map')
  autocmd! FileType which_key
  autocmd  FileType which_key set laststatus=0
    \| autocmd BufLeave <buffer> set laststatus=2
augroup END

" ----------------------------------------------------------------------------
" vim-which-key
" ----------------------------------------------------------------------------
nnoremap <silent> <leader>      :<c-u>WhichKey '<Space>'<CR>
vnoremap <silent> <leader>      :<c-u>WhichKeyVisual '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey '\'<CR>
let g:which_key_map = {}
let g:which_key_map.2 = 'which_key_ignore'
let g:which_key_map.3 = 'which_key_ignore'
let g:which_key_map.4 = 'which_key_ignore'
let g:which_key_map.5 = 'which_key_ignore'
let g:which_key_map.6 = 'which_key_ignore'
let g:which_key_map.7 = 'which_key_ignore'
let g:which_key_map.8 = 'which_key_ignore'
let g:which_key_map.9 = 'which_key_ignore'
let g:which_key_map.b = {
      \ 'name' : '+buffer' ,
      \ '1' : ['b1'        , 'buffer 1']        ,
      \ '2' : ['b2'        , 'buffer 2']        ,
      \ 'd' : ['bd'        , 'delete-buffer']   ,
      \ 'f' : ['bfirst'    , 'first-buffer']    ,
      \ 'h' : ['Startify'  , 'home-buffer']     ,
      \ 'l' : ['blast'     , 'last-buffer']     ,
      \ 'n' : ['bnext'     , 'next-buffer']     ,
      \ 'p' : ['bprevious' , 'previous-buffer'] ,
      \ '?' : ['Buffers'   , 'fzf-buffer']      ,
      \ }

Problem Description

If I press <Space> to active which-key, then resize neovim pane size in tmux, the neovim pane become blank until I press <ESC> to quit which-key or complete some mapping in which-key table.

image
image

@liuchengxu
Copy link
Owner

Thanks for the report. Please see if this branch fixes this issue.

@jiaming-shi
Copy link
Author

Thanks for the quick fix, it basically works, but still have some problems.

Scene 1

  • step 1: If I open neovim in a small window, activate which-key,
    image
  • step 2: and then maximize the window, which-key is correctly re-arranged.
    image
  • step 3: But if I restore to the previous small window, which-key will maintain the layout in full screen state, will not rearrange, resulting in some content not visible.
    image

In addition, if I did not complete a mapping in which-key in the first step, then pressing any key in the second step has no effect, the whole interface is stuck, I can only kill the neovim process to quit.
If I have done a mapping in the first step, then in the second step, when I complete a mapping again, the window will become blank,
image
then by pressing esc or other keys, the contents of the window will be refreshed, but the size is the first step size not fullscreen size.
image

Scene 2

  • start in fullscreen
  • resize to a small size
  • return to fullscreen

After these three steps, I will encounter the same problem in scene 1.

@liuchengxu
Copy link
Owner

Confirmed. After some investigation, I found it's probably getchar() that somehow leads to the VimResized event not triggered. It may not be that easy to figure this out, so currently there is not any workaround for this issue. Sorry about that and I'll keep looking for a solution.

@liuchengxu liuchengxu added the help wanted Extra attention is needed label Jan 1, 2019
@jiaming-shi
Copy link
Author

Thank you for your prompt reply, the scenes I mentioned are not common usage cases, so it will not affect the normal use of this plugin, and I will also try to find a solution.

@liuchengxu liuchengxu added the bug Something isn't working label Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants