lambdalisue/vim-fern

Failed to find a proper window to locate when popup is shown

bstaint opened this issue ยท 12 comments

neovim 0.8.0 dev

reproduce step:

let g:fern#drawer_width = 25

xxxxxxxxxxxxxx.c (The file name must be long enough)
GIF 2022-05-09 09-11-01

It will affect Window selector auto_select not work.

It seems the popup buffer introduced by #398 and #403 is buflisted.

other related issue

reproduce step:
cursor on popup buffer filename
q: open cmdline window

GIF 2022-05-09 17-58-26

I thougt this is because nobuflisted is not configured on the buffer but it was configured. https://github.com/lambdalisue/fern.vim/blob/master/autoload/fern/internal/drawer/hover_popup.vim#L76-L76

This will be fixed by lambdalisue/vital-Whisky#43

@bstaint I'm sorry for late. Could you try #425

help:

`relative` is empty for normal windows.

nvim_win_get_config(wi.winid).relative ==# '' will fixed.

Aha, fixed.

other related issue

reproduce step: cursor on popup buffer filename q: open cmdline window

GIF 2022-05-09 17-58-26

This question is related to the :
autocmd WinLeave <buffer> call s:auto_restore_focus_pre()

patch:

diff --git a/autoload/fern/internal/drawer/auto_restore_focus.vim b/autoload/fern/internal/drawer/auto_restore_focus.vim
index fcee18e..869e4a9 100644
--- a/autoload/fern/internal/drawer/auto_restore_focus.vim
+++ b/autoload/fern/internal/drawer/auto_restore_focus.vim
@@ -16,6 +16,7 @@ function! s:auto_restore_focus_pre() abort
         \ 'nwin': winnr('$'),
         \ 'tabpage': tabpagenr(),
         \ 'prev': win_getid(winnr('#')),
+        \ 'relative': nvim_win_get_config(win_getid(winnr('$'))).relative
         \}
   call timer_start(0, { -> extend(s:, {'info': v:null}) })
 endfunction
@@ -24,7 +25,7 @@ function! s:auto_restore_focus() abort
   if s:info is# v:null
     return
   endif
-  if s:info.tabpage is# tabpagenr() && s:info.nwin > winnr('$')
+  if s:info.tabpage is# tabpagenr() && s:info.nwin > winnr('$') && s:info.relative ==# ''
     call win_gotoid(s:info.prev)
   endif
   let s:info = v:null

I'm sorry for late. Well, the patch doesn't make sense so I cannot approve that.

OK. The latest #425 should fix the issue as well. Could you try? @bstaint

Tks.