1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-09-11 13:13:59 +03:00

Merge pull request #9066 from Clem-Fern/fix#8884

This commit is contained in:
Eugene 2023-10-06 13:20:43 +02:00 committed by GitHub
commit 34aeb797f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -340,7 +340,26 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
this.configure()
})
const cls: new (..._) => Frontend = {
// Check if the the WebGL renderer is compatible with xterm.js:
// - https://github.com/Eugeny/tabby/issues/8884
// - https://github.com/microsoft/vscode/issues/190195
// - https://github.com/xtermjs/xterm.js/issues/4665
// - https://bugs.chromium.org/p/chromium/issues/detail?id=1476475
//
// Inspired by https://github.com/microsoft/vscode/pull/191795
let enable8884Workarround = false
const checkCanvas = document.createElement('canvas')
const checkGl = checkCanvas.getContext('webgl2')
const debugInfo = checkGl?.getExtension('WEBGL_debug_renderer_info')
if (checkGl && debugInfo) {
const renderer = checkGl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL)
if (renderer.startsWith('ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero)')) {
enable8884Workarround = true
}
}
const cls: new (..._) => Frontend = enable8884Workarround ? XTermFrontend : {
xterm: XTermFrontend,
'xterm-webgl': XTermWebGLFrontend,
}[this.config.store.terminal.frontend] ?? XTermFrontend