neovide
neovide copied to clipboard
Handle different underlining styles supported by neovim
What kind of change does this PR introduce?
- Feature
- Fixes #764
Did this PR introduce a breaking change?
- No
Content
This overhauls the drawing of underlines and actually implements the undercurl that was simulated with underdashes before.
Implemented in this PR:
-
underline

-
underdouble

-
underdashed

-
underdotted

-
undercurl

Points to note
- Previously the underline thickness was proportional to the stroke width. This led to weird aliasing artifacts when drawing lines (especially dashes and dots) and isn't in line with how most other terminal emulators handle this. With this PR, all the lines are pixel-perfect and 1px thick. If desired, it'll be easy to add a configuration option to make it possible to configure the line thickness, but I don't recommend making it proportional to the text itself.
- The undercurl looks (in my opinion) nice, but I don't really know what I'm doing here. I'm using quadratic interpolation from skia by generating points under the text every time. I haven't noticed any hangups, but I'm sure there's a better optimized way to do this if it becomes an issue.
- I'm not sure if there should be an order of precedence between the different line styles (cf the TODO left in the code for now). I'm inclined to say we leave it like that, as I don't think multiple underline styles can happen at the same time in neovim (don't quote me on this though).
- Maybe the gap between the dots for
underdottedshould be widened? I'm worried it'll look like a thin solid line on high-dpi screens.
By the way, how did you even manage to set the "invalid" modifier names?
:hi! Normal gui=underdoubleresults into neovim yelling at me with "invalid value".
The latest neovim versions have aligned with vim's names. Therefore, underlineline became underdouble, for example. Maybe for stability we should handle both versions of the names?
Yeah, this is fair. In this case you should be able to just match both patterns using the | operator.
(also, small sidenote since formatting seems to be quite your nemesis: check out :h g:rustfmt_autosave, which will format the file automatically upon writing in neovim)
Alright. Truly, thank you! I'll merge this now.