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

Ligature Support #81

Closed
curran opened this issue Mar 9, 2019 · 8 comments
Closed

Ligature Support #81

curran opened this issue Mar 9, 2019 · 8 comments

Comments

@curran
Copy link
Contributor

curran commented Mar 9, 2019

This may be too much of an ask, but I thought I'd propose that CM6 support ligatures.

For example, I'd be interested in using FiraCode with certain ligatures enabled such as fat arrow.

Related:

@curran
Copy link
Contributor Author

curran commented Mar 9, 2019

I was able actually to get ligatures working in the CM6 demo!

Added the following:

<link rel="stylesheet" href="https://unpkg.com/[email protected]/distr/fira_code.css">
<style>
.codemirror { height: 300px; overflow: auto; border: 1px solid silver; font-family: 'Fira Code';}
</style>

image

Everything seems to work fine with ligatures (cursor placement, navigation).

Maybe this issue can be closed already, if there are no new special cases to handle.

I wonder if it's possible to enable only certain ligatures. Not sure... Probably out of CodeMirror scope.

@marijnh
Copy link
Member

marijnh commented Mar 9, 2019

What happens when you put the cursor in the middle of such a ligature? Last time I tried, several browsers did very wrong things there (like showing the cursor as if it is before the entire ligature). We'll have to do a survey of browser behavior to see how realistic this is.

@yury
Copy link

yury commented Mar 9, 2019

@marijnh Fira Code and Pragmata Pro work super awesome in browsers (and mobile too).

@curran
Copy link
Contributor Author

curran commented Mar 9, 2019

In Chrome and Firefox the cursor and selections in the middle of 1, 2, and 3 character ligatures behave exactly as if you were dealing with the original characters.

@yury
Copy link

yury commented Mar 9, 2019

Blink app use webkit to render terminal. And Fira Code works perfectly there.

IMG_80D92493C6E0-1

@marijnh
Copy link
Member

marijnh commented Oct 11, 2019

Maybe we could turn off ligatures selectively, based on the browser? Is anyone able to test this in Safari?

@curran
Copy link
Contributor Author

curran commented Oct 11, 2019

I've had good experience setting font-variant-ligatures dynamically, allowing users to flip a switch to enable or disable ligatures. No reason this could not be set based on browser detection. It almost feels like something that could/should live in "user space", outside CodeMirror. Not sure.

@marijnh
Copy link
Member

marijnh commented May 29, 2020

Modern browsers seem to handle ligatures pretty well, and for ones that conceptually contain multiple characters, they provide working cursor positions between the characters. Feel free to open an issue if something specific is broken, but I don't think this needs to say open.

@marijnh marijnh closed this as completed May 29, 2020
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