gelguy / wilder.nvim

A more adventurous wildmenu
MIT License
1.34k stars 35 forks source link

Flicker in help files when searching #141

Open Frederick888 opened 2 years ago

Frederick888 commented 2 years ago

When searching in Vim help files (:h xxx), wilder#wildmenu_renderer causes background of current match to flicker. I haven't observed this issue in other file types.

Neovim version:

NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

vimrc to reproduce this issue:

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath

function! UpdateRemotePlugins(...)
  if !has('nvim')
    return
  endif
  " Needed to refresh runtime files
  let &rtp=&rtp
  UpdateRemotePlugins
endfunction

call plug#begin('~/.vim/plugged')
Plug 'gelguy/wilder.nvim', { 'do': function('UpdateRemotePlugins') }
call plug#end()

set nocompatible
set updatetime=300
set cmdheight=2

" wilder.nvim
call wilder#enable_cmdline_enter()
set wildcharm=<Tab>
cmap <expr> <Tab> wilder#in_context() ? wilder#next() : "\<Tab>"
cmap <expr> <S-Tab> wilder#in_context() ? wilder#previous() : "\<S-Tab>"
cmap <expr> <C-n> wilder#in_context() ? wilder#next() : "\<C-n>"
cmap <expr> <C-p> wilder#in_context() ? wilder#previous() : "\<C-p>"
call wilder#set_option('modes', ['/', '?', ':'])
call wilder#set_option('pipeline', [
      \   wilder#branch(
      \     [
      \       wilder#check({ _, x -> empty(x) }),
      \       wilder#history(),
      \       wilder#result({
      \         'draw': [{ _, x -> ' ' . x }],
      \         }),
      \     ],
      \     [wilder#check({ _, x -> !(stridx(x, 'Man ') == 0 && strlen(x) < 6) })] + wilder#cmdline_pipeline({ 'debounce': 100 }),
      \     wilder#vim_search_pipeline(),
      \   ),
      \ ])
call wilder#set_option('renderer', wilder#renderer_mux({
      \ ':': wilder#popupmenu_renderer({
      \       'highlighter': wilder#basic_highlighter(),
      \       'left': [
      \         wilder#popupmenu_devicons(),
      \         ],
      \       'right': [
      \         ' ',
      \         wilder#popupmenu_scrollbar(),
      \         ],
      \       }),
      \ '/': wilder#wildmenu_renderer({
      \       'highlighter': wilder#basic_highlighter(),
      \       }),
      \ '?': wilder#wildmenu_renderer({
      \       'highlighter': wilder#basic_highlighter(),
      \       }),
      \ }))

Screen recording:

https://user-images.githubusercontent.com/4507647/173119614-0415eabf-4e7a-4a90-a277-18b4f01890bc.mp4

This problem goes away if I remove renderer for '/'.

gelguy commented 2 years ago

Thanks for the report!

I noticed this a few times but this issue helped me realise it specifically occurs when conceallevel is non-zero (which is the case for help files).

The related Neovim bug is https://github.com/neovim/neovim/issues/17810.

Frederick888 commented 5 months ago

I patched Neovim v0.9.5 with https://github.com/neovim/neovim/pull/27947 however this issue still persisted.

Not sure if https://github.com/neovim/neovim/pull/27947 actually relies on something else and I should try Neovim nightly instead.

I'll check it again when v0.10.0 is out.

Frederick888 commented 3 months ago

I'm using v0.10.0 now and unfortunately https://github.com/neovim/neovim/pull/27947 didn't help.

(I'm actually experiencing more flickering now in general. Not sure if they are relevant.)