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

A crashing character joiner brings down the whole terminal #3547

Closed
Eugeny opened this issue Nov 6, 2021 · 8 comments · Fixed by #3565
Closed

A crashing character joiner brings down the whole terminal #3547

Eugeny opened this issue Nov 6, 2021 · 8 comments · Fixed by #3565
Labels
Milestone

Comments

@Eugeny
Copy link
Member

Eugeny commented Nov 6, 2021

In particular, opentype.js cannot parse the updated Monaco font file in macOS Monterey (No valid cmap sub-tables found.), rendering xterm unusable when the ligature addon is active.

@Eugeny Eugeny added area/addon/ligatures type/bug Something is misbehaving labels Nov 6, 2021
@Tyriar
Copy link
Member

Tyriar commented Nov 8, 2021

Easy repro is probably to throw in the registerCharacterJoiner callback

@jerch
Copy link
Member

jerch commented Nov 11, 2021

On a sidenote - the particular issue might be fixed in opentype.js v0.9.0 (see opentypejs/opentype.js#348), while font-ligatures still uses v0.8.0.

@Eugeny
Copy link
Member Author

Eugeny commented Nov 11, 2021

It's not unfortunately - I've tried forcibly upgrading ot.js to their latest release

@jerch
Copy link
Member

jerch commented Nov 11, 2021

Ah ok. Well even if it was fixed, the character joiner should not tear down the whole terminal in the first place.

@LabhanshAgrawal
Copy link
Contributor

LabhanshAgrawal commented Nov 23, 2021

What if we create an anonymous function to try catch the handler (which returns empty array on catch) and use that instead of the actual handler at

const joiner: ICharacterJoiner = {
id: this._nextCharacterJoinerId++,
handler
};

Does this seem ok?

@Tyriar
Copy link
Member

Tyriar commented Nov 23, 2021

I think we just need to catch and handle exceptions here:

const joinedRanges: [number, number][] = this._characterJoiners[0].handler(text);
for (let i = 1; i < this._characterJoiners.length; i++) {
// We merge any overlapping ranges across the different joiners
const joinerRanges = this._characterJoiners[i].handler(text);

@LabhanshAgrawal
Copy link
Contributor

Yeah, that's the only place it's called at right now, so we can update there.
I was suggesting wrapping it, so that we don't have to worry about it later, in case it's called from other places. But that might not be necessary.

Should I go ahead and open a pr for this?

@Tyriar
Copy link
Member

Tyriar commented Nov 24, 2021

@LabhanshAgrawal I think that's the only place and probably won't change. That would be great!

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

Successfully merging a pull request may close this issue.

4 participants