Code Monkey home page Code Monkey logo

Comments (13)

tzachar avatar tzachar commented on May 31, 2024 2

I don't think this is related to nvim-scrollview. I encountered the same behavior, and am not using that plugin.
The problem usually arises when incsearch is enabled and searching for something not in the current viewport.
As you can see in the attached screen grab, for some reason the search reverts back to the previous searched for item on each key stroke.
wilder

b.t.w, I am using neovim nightly

from wilder.nvim.

gelguy avatar gelguy commented on May 31, 2024 2

I've found another workaround 😄.

Could you help verify if the latest master fixes the issue? It should be fixed for all renderers and all Neovim versions.

from wilder.nvim.

Gelio avatar Gelio commented on May 31, 2024 2

Yay 🎉 I'm using Neovim nightly and the issue seems to indeed be fixed. I've tested with both wildmenu_renderer and popupmenu_renderer and in both cases the incsearch highlight is stable 😄

Thanks for fixing it!

from wilder.nvim.

Frederick888 avatar Frederick888 commented on May 31, 2024 1

Wait... I'm so sorry... I played around with the files locally and there were conflicts when git pull so my wilder.nvim wasn't really up-to-date (face palm...)

Just updated and now the issue is gone. Thank you very much for the fix!

from wilder.nvim.

Racle avatar Racle commented on May 31, 2024

Changing mode doesn't work if you're using also scrollbar plugin (I'm using dstein64/nvim-scrollview and Neovim 0.5).

If file fits to screen, search highlighting works as intended (there is no scrollbar). If file is large and scrollbar becomes visible, wilder will break incsearch highlight.

Quickly way to test this out is to install scrollview and wilder, enable incsearch and try with small and large file.

from wilder.nvim.

gelguy avatar gelguy commented on May 31, 2024

The underlying root cause for the case with the scrollbar plugin is the same (neovim/neovim#14064) .

An oversimplified explanation: when redrawing windows, highlights are invalidated in some cases. If the viewport does not change too much, the rendering doesn't invalidate the window so the highlights are kept. However, if the viewport changes too much, or if there is a floating window overlaying the window, the highlights are invalidated.

Edit: I've found a workaround for the nvim-scrollview. Note that it has to rebind / which may conflict with some other plugins.

nnoremap / :call WilderStart()<CR>

function! WilderStart()
  call wilder#start_from_normal_mode()
  ScrollViewDisable
  call feedkeys('/', 'n')
endfunction

autocmd CmdlineLeave * ScrollViewEnable

from wilder.nvim.

gelguy avatar gelguy commented on May 31, 2024

I updated the original issue just yesterday - the statusline workaround does not work for Neovim 0.6 nightly.

Unfortunately I don't have another workaround for this.

from wilder.nvim.

tzachar avatar tzachar commented on May 31, 2024

10x. Added a confirmation on the nvim bug you opened.
Any idea what is the cause?

from wilder.nvim.

gelguy avatar gelguy commented on May 31, 2024

I bisected to the problematic commit in the issue mentioned above (neovim/neovim#14064).

In general, Neovim/Vim doesn't like it when redraw is called in the cmdline. The incsearch highlighting is a "temporary" highlight, and it gets invalidated when redrawing in certain cases e.g. the viewport moves or there is a floating/popup window over the buffer.

from wilder.nvim.

tzachar avatar tzachar commented on May 31, 2024

Then maybe the solution would be to update incsearch proactively after calling redraw? or not call redraw at all?

from wilder.nvim.

gelguy avatar gelguy commented on May 31, 2024

I've tried many workarounds, but none work so far. Fixing the code in Neovim seems to be the best option.

from wilder.nvim.

Frederick888 avatar Frederick888 commented on May 31, 2024

was being stupid... anyone who gets here pls ignore this comment...


Hate to be that guy but there's still a minor issue for me...

I'm using neovim 0.5.0 and when the first search hit is not in the view before starting searching, the highlights flicker sometimes:

The minimal vimrc I used:

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

" vim-plug
call plug#begin()
Plug 'gelguy/wilder.nvim'
call plug#end()

set incsearch

" 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#cmdline_pipeline(),
      \     wilder#search_pipeline(),
      \   ),
      \ ])
if has('nvim')
  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(),
        \       }),
        \ }))
else
  call wilder#set_option('renderer', wilder#wildmenu_renderer({
        \ 'highlighter': wilder#basic_highlighter(),
        \ }))
endif

" vim: set tabstop=4 softtabstop=0 expandtab shiftwidth=2 smarttab:

from wilder.nvim.

tzachar avatar tzachar commented on May 31, 2024

#65 fixes the issue for me.
10x

from wilder.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.