From 42e5b3473dddaebe35af22ab9ea66dd356e549c5 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 31 Aug 2017 23:12:42 -0700 Subject: [PATCH] Don't clear fg char if it's null or ' ' --- src/Terminal.ts | 2 +- src/renderer/ForegroundRenderLayer.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Terminal.ts b/src/Terminal.ts index c9c6466c..640aafaa 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -2046,7 +2046,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT public blankLine(cur?: boolean, isWrapped?: boolean, cols?: number): LineData { const attr = cur ? this.eraseAttr() : this.defAttr; - const ch: CharData = [attr, ' ', 1]; // width defaults to 1 halfwidth character + const ch: CharData = [attr, ' ', 1, 32 /* ' '.charCodeAt(0) */]; // width defaults to 1 halfwidth character const line: LineData = []; // TODO: It is not ideal that this is a property on an array, a buffer line diff --git a/src/renderer/ForegroundRenderLayer.ts b/src/renderer/ForegroundRenderLayer.ts index e5b814ce..680f1abc 100644 --- a/src/renderer/ForegroundRenderLayer.ts +++ b/src/renderer/ForegroundRenderLayer.ts @@ -50,10 +50,12 @@ export class ForegroundRenderLayer extends BaseRenderLayer implements IDataRende this._state.cache[x][y] = charData; continue; } - this._state.cache[x][y] = charData; - // Clear the old character - this.clearCells(x, y, 1, 1); + // Clear the old character if present + if (state && state[CHAR_DATA_CODE_INDEX] !== 32 /*' '*/) { + this.clearCells(x, y, 1, 1); + } + this._state.cache[x][y] = charData; // Skip rendering if the character is invisible if (!code || code === 32 /*' '*/) {