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

Wrong color of ligatures under cursor #177

Open
snaggen opened this issue Apr 11, 2024 · 6 comments
Open

Wrong color of ligatures under cursor #177

snaggen opened this issue Apr 11, 2024 · 6 comments

Comments

@snaggen
Copy link

snaggen commented Apr 11, 2024

When you are placing your cursor on a ligature like the one created by == the whole ligature gets the inverted foreground color, but only half of the ligature gets an inverted background. This makes the text invisible, which is quite confusing sometimes.

The fix would be that only the part that gets the inverted background should also get the inverted foreground color.

bild

@MoSal
Copy link
Contributor

MoSal commented Apr 11, 2024

If that ligature is a single glyph, then I think (haven't looked at that code for a while) what you propose would require glyph splitting support from the cosmic-text side, which would be quite the feature if a brave soul embarks on implementing it ;) I actually would have another use for it (line splitting in paragraphs if such a full-width ligature starts at num_cols - 1).

But does any shaping library have such a feature? If the answer is no, then there is probably a good reason for it.

It might be a little bit easier to invert the background in the other column, or maybe not render as a ligature (not sure about how to do the latter).

@snaggen
Copy link
Author

snaggen commented Apr 11, 2024

Well I don't know if ligature are a single glyph or not, I would assume so. However, here is how it looks in wezterm for the characters != rendered as a ligature:
bild

@snaggen
Copy link
Author

snaggen commented Apr 11, 2024

Also, inverting the background for the whole ligature will not work, since then you will no longer know in what position you have the cursor. So, inverting only half of the ligature like in the wezterm screenshot is the way to do it.

@jackpot51
Copy link
Member

I'm fairly certain that other renderers basically color some portion of the glyph (based on the number of unicode characters it contains) if you ask it to color only part of it.

@jackpot51
Copy link
Member

Another thing we could do as a workaround is just split up the ligature if it has different attributes.

@MoSal
Copy link
Contributor

MoSal commented Apr 11, 2024

Glyph splitting support would be great. Because in some cases, there is no ligature to split. Country flags (two single-width chars combining into a full-width flag) is an example I came across.* That example is extra fun because the noto font uses full-width glyphs for the country flag chars when they're not combining.

🇺 + 🇸 = 🇺🇸

* I'm interested in more examples if they exist (independently of the issue here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants