2

I'm dealing with a cryptic issue in my environment which is annoying and I have no idea where to start debugging. Random characters on that aren't actually in the document appear on screen after YCM auto complete menu goes away.

Pictures are worth a thousand words so here's a demo:

Step 1 - Type a variable name

enter image description here

Step 2 - Add a . and YCM auto complete follows

enter image description here

Step 3 - Delete the . and get annoyed by floating characters

enter image description here

Has anyone seen this before? I don't what the possible causes maybe which is why I also don't know what the relevant details are. If you think I should add something, just add and comment and I'll add it.

5
  • Have you figured out a solution? I am facing the same issue.
    – Unni
    Dec 4, 2019 at 4:59
  • I'm experienceing the same
    – stdcall
    Jan 3, 2022 at 7:18
  • a solution will be to somehow call "redraw!" everytime the completion menu dissapears.
    – stdcall
    Jan 3, 2022 at 7:40
  • 2
    I also have similar issues sometimes although not with ycm, but coc, my solution was to have this in my vimrc and call it when I need it: nnoremap <silent> <leader>m :noh <bar> call popup_clear()<cr>
    – fbence
    Jan 3, 2022 at 8:46
  • 1
    @Ben wanna post that as an answer? That way stdcall and fbence can comment on whether that solves the issue for them...
    – filbranden
    Jan 4, 2022 at 18:27

2 Answers 2

1

One idea based on the comments:

augroup fix_ycm_screen
  autocmd!
  autocmd CompleteDone * redraw!
augroup end
4
  • While it goes around the problem, it intrdocues a new problem of constant flickering in the screen.
    – stdcall
    Jan 5, 2022 at 19:28
  • 2
    @stdcall re: "constant flickering" is the completion coming up and being dismissed often? Perhaps :redraw sans bang would be less flickery. Maybe :call popup_clear() would be even better, if that still solves the problem?
    – D. Ben Knoble
    Jan 5, 2022 at 20:04
  • Another thing you can do is just hit <C-L>. Control-L. Jan 7, 2022 at 21:53
  • Yes, that is just :redraw
    – D. Ben Knoble
    Jan 8, 2022 at 16:49
1
+200

It looks like you simply have an old popup menu showing up and it hasn't been cleared. That's the root cause, as I understand. I could be wrong. Here is how to confirm:

See :highlight Pmenu and compare it to :highlight normal. Try setting one or both to something different - :highlight Pmenu ctermbg=red. Do the thing to cause the issue, and see if my suspicion is correct. The "weird symbols" showing up should be the remnants of the popup menu.


Now here's how to solve it (if I RC'd it properly):

Your popup meny doesn't get cleared for some reason, and you're unlucky in that your color scheme doesn't differentiate between your buffer background and popup menu color. There are already answers on how to fix this old popup menu existing. I'll aggregate them here and add some:

  • The best solution would be to actually have ycm properly clear the popup menu. This is the answer. Not sure how to do this or why isn't not doing this. Maybe re-install ycm or your version of vim. Lol.
  • Use a CompleteDone autocmd.
    • redraw! is too strong
    • clear might work, but maybe same issue as redraw.
    • call popup_clear() should be perfect.
  • Just manually call :clear whenever you run into this. (Or hit <C-l>, it does the same thing)

Turning this answer into a community wiki cuz it's high key sus if I just use other people's successful answers to collect this bounty lol

2
  • :highlight Pmenu ctermbg=red Proved to work. problem is when the color scheme and the popup background has the same color. I replaced a color scheme and the problem just vanished. clear(), popup_clear() and redraw() didn't help, only complete redaw! worked.
    – stdcall
    Jan 9, 2022 at 19:18
  • According to meta.stackexchange.com/questions/11740/…, you still receive rep for CW posts.
    – D. Ben Knoble
    Jan 11, 2022 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.