glacambre / firenvim

Embed Neovim in Chrome, Firefox & others.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Completion menu not correctly cleared, leading to screen corruption.

gi1242 opened this issue · comments

  • OS Version: Linux 6.6.17-1-lts
  • Browser Version: 122.0.1
  • Browser Addon Version: 0.2.15
  • Neovim Plugin Version: f2dd6d3

What I tried to do

Type text, with nvim-cmp enabled.

What happened

The completion menu is shown correctly. However, it is not cleared correctly and it leaves garbled trails all over the screen (see the screenshot below).

image

Please let me know if you need any more information.

THanks in advance,

GI

Thanks for including a screenshot, this is very useful. I would guess that this bug is caused by Firenvim clearing a single-cell character where it should really be clearing a wide one. I'll see if I can fix it :)

Thanks. I suspect the issue might also be related to scaling. On a computer with just one monitor and no display scaling, it works perfectly. I only have issues on a computer with two displays, where one display is scaled. (I'm using Plasma + Wayland and running firefox.)

Let me know if you can reproduce it, or if you need me to try and reproduce it in my one monitor system.

Thanks again.

GI

I just confirmed this still happens with just one monitor without scaling. (I also confirmed that this does not happen on my other machine.) I suspect there's some font instalation difference which is causing the bug. I haven't been able to trace it down, so if you have any ideas or suggestions please let me know.

I think we should try to replace repeat with repeat + 1 here:

https://github.com/glacambre/firenvim/blob/master/src/renderer.ts#L475

It's not great because we'll end up re-drawing the next cell even when it's not needed, but it should take care of the case of double-width characters.

I can confirm it's the wide characters causing the problem. If I disable the icons in my completion menus and just use text, then everything is cleared correctly.

I also can't get the icons to show up correctly in firenvim. They look like the screenshot above. In a terminal (or in nvim-qt), I see proper LSP icons with nerd fonts. However, in firenvim I can't get them to show up. So that might be messing up the width calculations...

Regardless, clearing an extra character won't be too much of a performance hit (I hope).

Thanks again,

GI

I also can't get the icons to show up correctly in firenvim.

Yes, unfortunately Firenvim cannot enumerate installed fonts nor the characters they contain, so the only thing it can do is draw characters hoping that they'll get rendered properly :(

Yes, unfortunately Firenvim cannot enumerate installed fonts nor the characters they contain, so the only thing it can do is draw characters hoping that they'll get rendered properly :(

Strange. Emojis like 😄 show up just fine. But the Nerd font symbols don't show up...

Thanks for your quick responses

Nerd font symbols don't show up...

Oh, okay, this explains everything. Nerd fonts are not "real" fonts, they patch existing fonts to assign more glyphs to unused characters. It's likely that Firenvim is not using your Nerd font but a "normal", unpatched one.

Oh, okay, this explains everything. Nerd fonts are not "real" fonts, they patch existing fonts to assign more glyphs to unused characters. It's likely that Firenvim is not using your Nerd font but a "normal", unpatched one.

Oh I see. I'll disable LSP icons during firenvim, which should make it usable for me.

Strange that I see screen corruption on one machine, and none on another (almost identically configured) machine....

Thanks again,

For anyone using Nerd fonts: If you put the nerd font before the regular font in your font-config then everything works perfectly. In my case I edited ~/.config/fontconfig/conf.d/50-defaults.conf and did this:

 <alias>
  <family>monospace</family>
  <prefer>
   <family>DejaVuSansM Nerd Font Mono</family>
   <family>Dejavu Sans Mono</family>
   ...
  </prefer>
 </alias>