(prevProps: TermProps)
| 334 | } |
| 335 | |
| 336 | componentDidUpdate(prevProps: TermProps) { |
| 337 | if (!prevProps.cleared && this.props.cleared) { |
| 338 | this.clear(); |
| 339 | } |
| 340 | |
| 341 | const nextTermOptions = getTermOptions(this.props); |
| 342 | |
| 343 | // Use bellSound in nextProps if it exists |
| 344 | // otherwise use the default sound found in xterm. |
| 345 | nextTermOptions.bellSound = this.props.bellSound || this.termDefaultBellSound!; |
| 346 | |
| 347 | if (!prevProps.search && this.props.search) { |
| 348 | this.search(); |
| 349 | } |
| 350 | |
| 351 | // Update only options that have changed. |
| 352 | ObjectTypedKeys(nextTermOptions) |
| 353 | .filter((option) => option !== 'theme' && nextTermOptions[option] !== this.termOptions[option]) |
| 354 | .forEach((option) => { |
| 355 | try { |
| 356 | this.term.setOption(option, nextTermOptions[option]); |
| 357 | } catch (_e) { |
| 358 | const e = _e as {message: string}; |
| 359 | if (/The webgl renderer only works with the webgl char atlas/i.test(e.message)) { |
| 360 | // Ignore this because the char atlas will also be changed |
| 361 | } else { |
| 362 | throw e; |
| 363 | } |
| 364 | } |
| 365 | }); |
| 366 | |
| 367 | // Do we need to update theme? |
| 368 | const shouldUpdateTheme = |
| 369 | !this.termOptions.theme || |
| 370 | nextTermOptions.rendererType !== this.termOptions.rendererType || |
| 371 | ObjectTypedKeys(nextTermOptions.theme!).some( |
| 372 | (option) => nextTermOptions.theme![option] !== this.termOptions.theme![option] |
| 373 | ); |
| 374 | if (shouldUpdateTheme) { |
| 375 | this.term.setOption('theme', nextTermOptions.theme); |
| 376 | } |
| 377 | |
| 378 | this.termOptions = nextTermOptions; |
| 379 | |
| 380 | if ( |
| 381 | this.props.fontSize !== prevProps.fontSize || |
| 382 | this.props.fontFamily !== prevProps.fontFamily || |
| 383 | this.props.lineHeight !== prevProps.lineHeight || |
| 384 | this.props.letterSpacing !== prevProps.letterSpacing |
| 385 | ) { |
| 386 | // resize to fit the container |
| 387 | this.fitResize(); |
| 388 | } |
| 389 | |
| 390 | if (prevProps.rows !== this.props.rows || prevProps.cols !== this.props.cols) { |
| 391 | this.resize(this.props.cols!, this.props.rows!); |
| 392 | } |
| 393 | } |
nothing calls this directly
no test coverage detected