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

Uncaught TypeError: Cannot read properties of undefined (reading 'colors') #4840

Open
xlvchao opened this issue Oct 11, 2023 · 1 comment
Open

Comments

@xlvchao
Copy link

xlvchao commented Oct 11, 2023

Details

  • Browser and browser version: chrome 117.0.5938.150
  • OS version: win11
  • xterm: 5.0.0
  • xterm-addon-fit: 0.6.0
  • xterm-addon-webgl: 0.13.0

My code

/** init xterm **/
const fitAddon = new FitAddon();
const webglAddon = new WebglAddon();
let xterm = new Terminal({ allowProposedApi: true })
function initXterm(scrollback: string) {
let scrollNumber = parseInt(scrollback, 10)
xterm = new Terminal({
screenReaderMode: false,
convertEol: true,
allowProposedApi: true,
scrollback: isValidNumber(scrollNumber) ? scrollNumber : DEFAULT_SCROLL_BACK
});
xterm.loadAddon(fitAddon)

xterm.open(document.getElementById('terminal')!);

xterm.loadAddon(webglAddon)
fitAddon.fit()
return {
cols: xterm.cols,
rows: xterm.rows
}
}

Debug problems

WebglAddon.ts:40 Uncaught TypeError: Cannot read properties of undefined (reading 'colors')
at t2.WebglAddon.activate (WebglAddon.ts:40:69)
at t2.AddonManager.loadAddon (AddonManager.ts:31:14)
at d.loadAddon (Terminal.ts:239:24)
at initXterm (Console.vue:123:9)
at ws.onopen (Console.vue:82:28)

The WebglAddon.ts 40 line is: const colors: IColorSet = (terminal as any)._core._colorManager.colors;

@tisilent
Copy link
Contributor

try a new version.

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

2 participants