From f12eb5367bd2bf566cffd18c9407f8c936d7f7cb Mon Sep 17 00:00:00 2001 From: Bruno Ribeito Date: Wed, 8 Nov 2017 23:40:13 +0000 Subject: [PATCH] Adress feedback --- src/Terminal.ts | 23 +++++++++++++++-------- typings/xterm.d.ts | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Terminal.ts b/src/Terminal.ts index 1f08ce8a..9b3e485c 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -367,6 +367,16 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT value = 'block'; } break; + case 'fontWeight': + if (!value) { + value = 'normal'; + } + break; + case 'fontWeightBold': + if (!value) { + value = 'bold'; + } + break; case 'lineHeight': if (value < 1) { console.warn(`${key} cannot be less than 1, value: ${value}`); @@ -419,17 +429,14 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT break; case 'letterSpacing': case 'lineHeight': + case 'fontWeight': + case 'fontWeightBold': + const didCharSizeChange = (key === 'fontWeight' || key === 'fontWeightBold'); + // When the font changes the size of the cells may change which requires a renderer clear this.renderer.clear(); - this.renderer.onResize(this.cols, this.rows, false); + this.renderer.onResize(this.cols, this.rows, didCharSizeChange); this.refresh(0, this.rows - 1); - // this.charMeasure.measure(this.options); - case 'fontWeight': - case 'fontWeightBold': - // When the font weight changes the size of the cells may change which requires a renderer clear - this.renderer.clear(); - this.renderer.onResize(this.cols, this.rows, true); - this.refresh(0, this.rows - 1); case 'scrollback': this.buffers.resize(this.cols, this.rows); this.viewport.syncScrollArea(); diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index aa7d8f3e..ced58fcf 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -404,7 +404,7 @@ declare module 'xterm' { * Retrieves an option's value from the terminal. * @param key The option key. */ - getOption(key: 'bellSound' | 'bellStyle' | 'cursorStyle' | 'fontFamily' | 'termName'): string; + getOption(key: 'bellSound' | 'bellStyle' | 'cursorStyle' | 'fontFamily' | 'fontWeight' | 'fontWeightBold'| 'termName'): string; /** * Retrieves an option's value from the terminal. * @param key The option key.