liuchengxu / vim-clap

:clap: Modern performant fuzzy picker, tree-sitter highlighting, and more, for both Vim and NeoVim
https://liuchengxu.github.io/vim-clap/
MIT License
2.11k stars 87 forks source link

Neovim redraw “freezes” when clap is enabled #516

Closed hadronized closed 3 years ago

hadronized commented 4 years ago

Warning: if you don't fill this issue template and provide the reproducible steps the issue could be closed directly.

Environment (please complete the following information):

Features: +acl +iconv +tui

 - vim-clap version: git commit `973ebcf5411eea777450673b0b3f132beb5004d7`
 - Have you reproduced with a minimal vimrc: no
 - Have you updated to the latest plugin version: yes
 - Have you upgraded to/compiled the latest Rust binary: yes <!-- Try runninng `:Clap install-binary!` in vim -->

**Describe the bug**
Neovim somehow freezes” until I type something, regardless of whether a clap window is open or not (I don’t have that problem if I remove clap from my plugins).

---

Step 1: simply open neovim on a file with another window next to it.

![img_090320_124113](https://user-images.githubusercontent.com/506592/92105248-daf36f00-ede2-11ea-93af-dca830aa42a9.png)

Step 2: expand the neovim window and don’t touch anything. You can see a glitched window (half the window is not redrawn).

![img_090320_124123](https://user-images.githubusercontent.com/506592/92105294-eba3e500-ede2-11ea-98b3-494adba18eeb.png)

Step 3: type any key (I simply move the cursor). The window gets redrawn completely.

![img_090320_124132](https://user-images.githubusercontent.com/506592/92105319-f52d4d00-ede2-11ea-9d07-1c50353cdd40.png)

**Clap debug**

<!-- Paste the output of :Clap debug here, or try :Clap debug+. -->
        has cargo: 1
        has maple: /home/phaazon/.config/nvim/plugged/vim-clap/target/release/maple
       maple info: version 0.1.20, built for x86_64-unknown-linux-gnu by rustc 1.45.2 (d3fb005a3 2020-07-31).

     has +python3: 1

has py dynamic module: 1 Current FileType: toml Third Party Providers: [] Global Options: let g:clap#autoload_dir = '/home/phaazon/.config/nvim/plugged/vim-clap/autoload' let g:clap#provider_alias = {'gfiles': 'git_files', 'hist:': 'command_history', 'hist/': 'search_history'} let g:clap_current_selection_sign = {'texthl': 'ClapCurrentSelectionSign', 'linehl': 'ClapCurrentSelection', 'text': '->'} let g:clap_disable_bottom_top = 0 let g:clap_disable_matches_indicator = v:false let g:clap_disable_optional_async = v:false let g:clap_disable_run_rooter = v:false let g:clap_enable_debug = v:false let g:clap_enable_icon = 1 let g:clap_forerunner_status_sign = {'done': '•', 'running': '!', 'using_cache': '*'} let g:clap_fuzzy_match_hl_groups = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] let g:clap_insert_mode_only = v:true let g:clap_multi_selection_warning_silent = 0 let g:clap_no_matches_msg = 'NO MATCHES FOUND' let g:clap_open_action = {'ctrl-v': 'vsplit', 'ctrl-x': 'split', 'ctrl-t': 'tab split'} let g:clap_popup_border = 'rounded' let g:clap_preview_size = 5 let g:clap_providers_relaunch_code = '@@' let g:clap_search_box_border_style = 'nil' let g:clap_search_box_border_symbols = {'nil': ['', ''], 'curve': ['', ''], 'arrow': ['', '']} let g:clap_selected_sign = {'texthl': 'ClapSelectedSign', 'linehl': 'ClapSelected', 'text': ' ·'} Provider Variables: []

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.96. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

liuchengxu commented 4 years ago

I don't think vim-clap is responsible for this issue as you even don't open it. And you are not opening two Vim windows, but two terminal windows. I guess the other fuzzy finders will have the same problem as it's probably an issue of neovim itself, try fzf.vim, see if this issue persists.

hadronized commented 4 years ago

No problem with fzf.vim; as mentioned in the issue, the problem disappears as soon as I remove vim-clap from my plugins.

liuchengxu commented 4 years ago

I still don't see why vim-clap is related.

hadronized commented 4 years ago

I tried to :profile but I got a zero-byte profile file (maybe I miss something here). Do you have any idea how I could debug that issue?

liuchengxu commented 4 years ago

Maybe this can help https://vi.stackexchange.com/a/277

hadronized commented 4 years ago

Yeah, I get a trace but I’m not sure how it’s going to be interesting. I guess you are using a display feature and not resetting it / using it correctly, because I don’t have the bug with other plugins. However, it looks like it’s not triggered if I start neovim and do not use any clap feature (it starts doing it as soon as I do for instance :Clap buffers). Even with the clap floating window closed, it still behaves incorrectly afterwards.

EDIT: it’s not a focus issue because even when getting the focus back, the window still doesn’t redraw. An input is required.

liuchengxu commented 4 years ago

it looks like it’s not triggered if I start neovim and do not use any clap feature

That's why I don't understand clap is related here, if you don't open clap, there is only a few autocmds of clap taking effect, see https://github.com/liuchengxu/vim-clap/blob/master/plugin/clap.vim, which won't lead to this issue in my opinion.

hadronized commented 4 years ago

Yes, agreed. So the problem happens after a clap window has been opened. I can open a clap window, close it, resize the window: the problem appears. A clap window doesn’t have to be open for the problem to appear, but it looks like one has to have been opened previously (at least once).

karlc1 commented 4 years ago

I just want to confirm that I have this exact same issue using neovim nightly and clap on ubuntu. I have tried using both ctrlp and fzf, without getting this issue, but as soon as I search using clap the rescaling on window resize stops working correctly and requires an additional key press before looking correct again. As op mentioned, this behavior starts when I open clap, and persists even after I close the clap window until I exit neovim.

hadronized commented 4 years ago

Yes, I still have it too. I’m not sure what causes it, though. :(

Galicarnax commented 3 years ago

The same here. Using tiling window manager. 1) Open a terminal and start nvim in it. Open a file with :e /path/to/file. Open another terminal, so that the first one shrinks. Then close the second terminal. The terminal with nvim grows back. No probem. 2) Do the same steps, but instead of :e /path/to/file use, e.g. :Clap history to open file. Then on the last step (after nvim's terminal is restored to original size), the content is jumbled up. Have to use Ctrl-L to redraw.

romgrk commented 3 years ago

Does it still happen if you apply this patch?

diff --git a/autoload/clap/floating_win.vim b/autoload/clap/floating_win.vim
index e94ad1a..9cdf23a 100644
--- a/autoload/clap/floating_win.vim
+++ b/autoload/clap/floating_win.vim
@@ -84,6 +84,7 @@ function! g:clap#floating_win#display.open() abort
 endfunction

 function! clap#floating_win#redo_layout() abort
+  return
   let s:display_opts = clap#layout#calc()
   call nvim_win_set_config(s:display_winid, s:display_opts)
   call nvim_win_set_config(s:spinner_winid, s:get_config_spinner())
Galicarnax commented 3 years ago

No, it doesn't. The problem disappers after applying the patch.