microsoft / cascadia-code

This is a fun, new monospaced font that includes programming ligatures and is designed to enhance the modern look and feel of the Windows Terminal.
Other
25.16k stars 797 forks source link

Infinite arrows performs not well with zsh-syntax-highlighting #562

Closed Jyunta closed 2 years ago

Jyunta commented 2 years ago

Cascadia family version

2106.17

Cascadia family variant(s)

Cascadia Code (the version with ligatures)

Font file format(s)

.ttf (variable)

Platform

MacOS 12.0 Beta(21A5304g)

Other Software

Terminal.app iTerm

What happened?

With zsh-syntax-highlighting, Infinite arrows of Cascadia Code performs not well, as showed below. image

At first I think maybe it's because of the compatibility with zsh-syntax-highlighting. But I found Fira Code performs perfect with it. image

I noticed that in this latest release of Cascadia Code, ==, <<=, >>=, =>>, =<< 's ligature is disabled. To be honest, it's very disappointing for me. It seems that it's to preserve the ligature===>? But in my opinion, the using frequency of ==, <<=, >>=, =>>, =<< is much higher than ===> for most users. I guess maybe it also resulted in the bad compatibility with zsh-syntax-highlighting?

I really hope you could enable the ligature of ==, <<=, >>=, =>>, =<< again. Maybe it's not only my request, as I found some other users also suggested it.

The Fira Code's ligature is perfect. But I love Cascadia Code so much as it's so beautiful and comfortable to read. I can't abandon it. Hope it will be better.

Thanks in advance.

aaronbell commented 2 years ago

Huh. I've seen other cases where color syntaxing breaks ligatures, so I would have expected it to be a problem with both Cascadia and Fira Code. I'll do some investigations and see if I can figure out why things are not working.

I really hope you could enable the ligature of ==, <<=, >>=, =>>, =<< again. Maybe it's not only my request, as I found some other users also suggested it.

With regard to ==, there is actually a ligature, but I have added a break in the form because, often times, it can be hard to discern the difference between = and == at a glance. I have considered adding a stylistic set to reconnect it, but have not done so as of yet.

For the others, unfortunately there is a ligature conflict with coding languages such as Javascript (#435). Again, I may implement a stylistic set to implement the connected versions but have not done so as of yet.

aaronbell commented 2 years ago

Hi. I finally had a chance to do some investigations into this, and interestingly I have not been able to repro your example of Fira Code. For both Cascadia Code and Fira Code (v5.2), the syntax highlighting causes the ligatures to break.

I can verify that the ligatures are working as intended as typing >>>>==== forms a proper arrow ligature on the right side. It is only where the coloration changes that the ligatures are broken. This is consistent with other examples of style interruptions in a text run (such as in Word, etc.)

Unfortunately, I don't think that this is anything that we can fix in the font as it has to do with how the terminal environment is modifying the text run. And ultimately oh my zsh is going to need to modify their approach to account for this scenario.

I'm still surprised that your Fira Code is working, but have no idea why. Sorry!