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

Fix safari not properly rendering Terminal #160144

Closed
wants to merge 1 commit into from

Conversation

jeanp413
Copy link
Contributor

@jeanp413 jeanp413 commented Sep 6, 2022

Fixes #160070

Safari doesn't support device-pixel-content-box yet which is used by both webgl and canvas addons

@benz0li
Copy link

benz0li commented Sep 6, 2022

The problem was introduced with 852b4ae (Update to xterm 5) and 2f72682 (Add canvas renderer addon).

Cross reference: xtermjs/xterm.js#3271

ℹ️ Canvas rendering was working fine using Safari with VS Code v1.70.2 (xterm 4.20.0).

@benz0li
Copy link

benz0li commented Sep 6, 2022

1.71.0 (xterm v5.0.0 (beta 32))

This is the situation after reloading the page.

1.71.0.mp4

When starting a new Terminal, Safari falls back to the DOM renderer (see coder/code-server#5535 (comment)). But when reloading the page, there are some canvas renderer objects overlayed.

1.70.2 (xterm v4.20.0 (beta 20))

1.70.2.mp4

Safari uses the canvas renderer.

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is meant to be handled gracefully by just disabling the observer here:

https://github.com/silamon/xterm.js/blob/e8e2f16cffe89e9a08899a2a37c2a4cfa580cca9/src/browser/renderer/DevicePixelObserver.ts#L20-L25

Does something here throw on Safari or something?

@jeanp413
Copy link
Contributor Author

jeanp413 commented Sep 7, 2022

@Tyriar yes it throws in this line observer.observe(element, { box: ['device-pixel-content-box'] } as any);

@Tyriar
Copy link
Member

Tyriar commented Sep 7, 2022

Oh ok, the right fix is to put a try/catch around that then. Can you want to send a PR to xterm.js instead?

@jeanp413
Copy link
Contributor Author

jeanp413 commented Sep 7, 2022

Sure

@jeanp413
Copy link
Contributor Author

jeanp413 commented Sep 7, 2022

Here xtermjs/xterm.js#4105

Closing this.

@jeanp413 jeanp413 closed this Sep 7, 2022
@jeanp413
Copy link
Contributor Author

jeanp413 commented Sep 7, 2022

BTW @Tyriar will this be picked for the recovery release as is a regression from previous release? that was my main reason to fix it here instead 🙂

@Tyriar
Copy link
Member

Tyriar commented Sep 7, 2022

@jeanp413 yeah I guess this meets the bar for a recovery fix, I'll cherry pick this commit into a recovery release PR as it's a pain to update xterm in recovery releases.

@benz0li
Copy link

benz0li commented Sep 7, 2022

Thank you @jeanp413.

@Tyriar
Copy link
Member

Tyriar commented Sep 7, 2022

👉 #160332

@github-actions github-actions bot locked and limited conversation to collaborators Oct 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Safari not properly rendering Terminal after page reload
3 participants