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

Screen flicker when buffer completion is enabled for searching #1061

Closed
2 tasks done
MrConnorKenway opened this issue Jan 23, 2025 · 8 comments · Fixed by #1305
Closed
2 tasks done

Screen flicker when buffer completion is enabled for searching #1061

MrConnorKenway opened this issue Jan 23, 2025 · 8 comments · Fixed by #1305
Labels
bug Something isn't working

Comments

@MrConnorKenway
Copy link

MrConnorKenway commented Jan 23, 2025

Make sure you have done the following

  • Updated to the latest version of blink.cmp
  • Searched for existing issues and documentation (try <C-k> on https://cmp.saghen.dev)

Bug Description

With default sources:

flicker.mov

With

sources = {
  default = { 'lsp', 'path' },
  cmdline = function()
    local type = vim.fn.getcmdtype()
    -- Commands
    if type == ':' or type == '@' then return { 'cmdline' } end
    return {}
  end
}
no.flicker.mov

Problem still exists when noice.nvim is disabled.

neovim version

0.10.3

blink.cmp version

0.10.0

@MrConnorKenway MrConnorKenway added the bug Something isn't working label Jan 23, 2025
@Saghen
Copy link
Owner

Saghen commented Feb 20, 2025

Are you still able to reproduce this on 0.12.*? If so, can you provide a repro.lua for this? I'm not able to reproduce this on my system with 0.10 or nightly with the default repro.lua

@jdrouhard
Copy link
Contributor

Don't have time at this exact moment to make a repro.lua, but yes this problem still exists.

It looks like the problem is with drawing the completion menu floating window specifically for command line completions. I can reproduce this simply by using the default blink config (so cmdline has the buffer source enabled), and then typing '/' and a search term with incsearch on. As I type, the incsearch highlights flicker. Disable cmdline sources (so no more blink floating window for the cmdline), flicker disappears.

@MrConnorKenway
Copy link
Author

Are you still able to reproduce this on 0.12.*? If so, can you provide a repro.lua for this? I'm not able to reproduce this on my system with 0.10 or nightly with the default repro.lua

Yes. I use the same repro.lua you provided:

flicker.mov

@Saghen
Copy link
Owner

Saghen commented Feb 21, 2025

I've tried on the repro.lua on 0.10/nightly and on foot, kitty and alacritty but I still can't reproduce. If someone is able to, try playing around with the calls to nvim__redraw

jdrouhard added a commit to jdrouhard/blink.cmp that referenced this issue Feb 23, 2025
Setting the decoration provider on every renderer:draw() command caused
flickering of incsearch highlights when showing completions for / and ?
search modes on the cmdline as characters were typed.

Decoration providers only need to be set once and they remain active, so
the fix here is create it when the renderer is created and remember the
last bufnr that was drawn to, along with the columns.

Fixes Saghen#1061
@jdrouhard
Copy link
Contributor

Spent a better part of the day debugging this and finally nailed down exactly what was causing it. PR to fix is up and linked to this issue.

jdrouhard added a commit to jdrouhard/blink.cmp that referenced this issue Feb 23, 2025
Setting the decoration provider on every renderer:draw() command caused
flickering of incsearch highlights when showing completions for / and ?
search modes on the cmdline as characters were typed.

Decoration providers only need to be set once and they remain active, so
the fix here is create it when the renderer is created and remember the
last bufnr that was drawn to, along with the columns.

Fixes Saghen#1061
@Saghen Saghen closed this as completed in d2fbc41 Feb 23, 2025
@jdrouhard
Copy link
Contributor

Ugh, @Saghen hate to say this but the PR improved the flicker a little but didn't actually fully fix it. We may want to reopen this until I can dig into this more.

@Saghen Saghen reopened this Feb 24, 2025
@jdrouhard
Copy link
Contributor

Or, we can make a new issue. It's only flickering now when cursorline is enabled and it only flickers the current match (not the other matches on the screen)

@jdrouhard
Copy link
Contributor

Lets do that @Saghen - I'll open a new issue to track flickering specifically with cursorline which only affects the current line's incsearch (not the other hlsearch highlights). This is still resolved for the most part with my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants