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

Cursor issues in terminal buffer #205

Closed
unlockedmutex opened this issue Mar 19, 2020 · 8 comments
Closed

Cursor issues in terminal buffer #205

unlockedmutex opened this issue Mar 19, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@unlockedmutex
Copy link
Contributor

When in the terminal buffer in terminal mode, the cursor is offset by a little bit, and shifts the character below it as well when moving the cursor around.

Exiting to normal mode leaves a space after the character that used to be before the cursor in insert mode.

Here's a gif illustrating these issues:
ezgif-2-ea7165587fdf

@Kethku
Copy link
Member

Kethku commented Mar 19, 2020

When you type into a normal text buffer do you run into the same issue? What do you have guifont set to? Does it happen without any configuration?

@unlockedmutex
Copy link
Contributor Author

When you type into a normal text buffer do you run into the same issue? What do you have guifont set to? Does it happen without any configuration?

I don't have the same issue in a text buffer, and I haven't set anything for guifont. Also, that gif is from running neovide --clean, so no config.

@unlockedmutex
Copy link
Contributor Author

Actually, setting guifont to Lucida_Console:h11 solves the issue. The default font must have something wrong with it's spacing.

Not setting guifont, it seems that there is also a similar issue in the "command entry" part of the window (not sure what it's actually called). It seems spaces don't take up as much space as they should, which is not the case in the text buffer. Here's another gif detailing the issue:
ezgif-2-f9a35fcb2580

@Kethku Kethku added the bug Something isn't working label Mar 19, 2020
@Kethku
Copy link
Member

Kethku commented Mar 20, 2020

What platform are you running on? Arch Linux?

@unlockedmutex
Copy link
Contributor Author

What platform are you running on? Arch Linux?

Operating System: Ubuntu 19.10
Kernel: Linux 5.3.0-42-generic

@glacambre
Copy link

glacambre commented Apr 2, 2020

Can reproduce on Ubuntu 18.04+Linux 5.3.0+i3 4.14.1+nvim v0.5.0-384-ga2efc9cf8+neovide c78fb4a. I don't need to be in a terminal/command line to reproduce, insert mode in a regular buffer also triggers this bug.
Setting set guifont=monospace also makes the issue disappear. I'm still noticing two issues that might be related, as they seem to have something to do with the way the size of glyphs is computed:

  • Letters aren't separated by the same amount of space everywhere:
    screenshot_2020-04-02-14:34:50
  • When dragging neovim's cursor with the mouse from line 0, col 0 to line 64, col 100, the cursor doesn't follow the mouse properly. When the mouse reaches y:64,x:100, neovim's cursor is only on y:43, x:66. This probably means that Neovide thinks the glyphs are bigger than they actually are?

Making the font bigger with :set guifont=monospace:h22 does not make these issues disappear (but it does make the spacing issue less noticeable).

@glacambre
Copy link

Font dimensions are computed using metrics
https://github.com/Kethku/neovide/blob/c78fb4a6794f2dcaa08be524e07a571deb18a6db/src/renderer/caching_shaper.rs#L277-L279
Which are taken from the current font set:
https://github.com/Kethku/neovide/blob/c78fb4a6794f2dcaa08be524e07a571deb18a6db/src/renderer/caching_shaper.rs#L213-L214
Which is built out of FontCollections:
https://github.com/Kethku/neovide/blob/c78fb4a6794f2dcaa08be524e07a571deb18a6db/src/renderer/caching_shaper.rs#L151-L155
Provided by Skribo:
https://github.com/Kethku/neovide/blob/c78fb4a6794f2dcaa08be524e07a571deb18a6db/src/renderer/caching_shaper.rs#L11

But as far as I can tell, font shaping is actually done by Skia:
https://github.com/Kethku/neovide/blob/c78fb4a6794f2dcaa08be524e07a571deb18a6db/src/renderer/caching_shaper.rs#L237-L248

So perhaps there is a discrepancy between the way Skribo computes glyph size and the way Skia does it? Skia has its own font metrics:
https://docs.rs/skia-safe/0.17.0/skia_safe/font_metrics/struct.FontMetrics.html

What's odd is that while there does seem to be a way to retrieve the max width of the character set, there's no way to know the max height. Perhaps because self.base_size is the cell height?

@Kethku
Copy link
Member

Kethku commented Jun 22, 2021

These issues have been fixed in main.

@Kethku Kethku closed this as completed Jun 22, 2021
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

No branches or pull requests

3 participants