From 79d47893df3e734b25225318a0d0a45d4020d02f Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 19 Aug 2022 13:19:08 -0700 Subject: [PATCH 1/6] Move webgl underline rendering down See microsoft/vscode#158326 --- addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts b/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts index 13dceae6..72421b2d 100644 --- a/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts +++ b/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts @@ -439,8 +439,7 @@ export class WebglCharAtlas implements IDisposable { if (underline) { this._tmpCtx.save(); const lineWidth = Math.max(1, Math.floor(this._config.fontSize * window.devicePixelRatio / 15)); - // When the width is odd, draw at 0.5 position. Offset by an additional 1 dpr to bring the - // underline closer to the character + // When the line width is odd, draw at a 0.5 position const yOffset = (lineWidth % 2 === 1 ? 0.5 : 0) + window.devicePixelRatio; this._tmpCtx.lineWidth = lineWidth; @@ -463,9 +462,9 @@ export class WebglCharAtlas implements IDisposable { this._tmpCtx.beginPath(); const xLeft = padding; const xRight = padding + this._config.scaledCellWidth; - const yTop = Math.ceil(padding + this._config.scaledCharHeight - lineWidth) - yOffset; - const yMid = padding + this._config.scaledCharHeight - yOffset; - const yBot = Math.ceil(padding + this._config.scaledCharHeight + lineWidth) - yOffset; + const yTop = Math.ceil(padding + this._config.scaledCharHeight) - yOffset; + const yMid = padding + this._config.scaledCharHeight + lineWidth - yOffset; + const yBot = Math.ceil(padding + this._config.scaledCharHeight + lineWidth * 2) - yOffset; switch (this._workAttributeData.extended.underlineStyle) { case UnderlineStyle.DOUBLE: this._tmpCtx.moveTo(xLeft, yTop); From 0698afaf12c89df34b6c72edca9a7e229b4ff0fe Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 19 Aug 2022 13:24:39 -0700 Subject: [PATCH 2/6] Only stroke glyph when font size >= 12 --- addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts b/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts index 72421b2d..a7e92f94 100644 --- a/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts +++ b/addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts @@ -440,7 +440,7 @@ export class WebglCharAtlas implements IDisposable { this._tmpCtx.save(); const lineWidth = Math.max(1, Math.floor(this._config.fontSize * window.devicePixelRatio / 15)); // When the line width is odd, draw at a 0.5 position - const yOffset = (lineWidth % 2 === 1 ? 0.5 : 0) + window.devicePixelRatio; + const yOffset = lineWidth % 2 === 1 ? 0.5 : 0; this._tmpCtx.lineWidth = lineWidth; // Underline color @@ -527,8 +527,9 @@ export class WebglCharAtlas implements IDisposable { this._tmpCtx.restore(); // Draw stroke in the background color for non custom characters in order to give an outline - // between the text and the underline - if (!customGlyph) { + // between the text and the underline. Only do this when font size is >= 12 as the underline + // looks odd when the font size is too small + if (!customGlyph && this._config.fontSize >= 12) { // This only works when transparency is disabled because it's not clear how to clear stroked // text if (!this._config.allowTransparency && chars !== ' ') { From b59de22c36ac376ff83bec563c0cb2a2dcb5429c Mon Sep 17 00:00:00 2001 From: greenmashimaro Date: Tue, 23 Aug 2022 15:09:43 +0800 Subject: [PATCH 3/6] fix typo --- src/common/buffer/BufferSet.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/buffer/BufferSet.ts b/src/common/buffer/BufferSet.ts index 7d07cec8..f940bb8f 100644 --- a/src/common/buffer/BufferSet.ts +++ b/src/common/buffer/BufferSet.ts @@ -58,14 +58,14 @@ export class BufferSet extends Disposable implements IBufferSet { } /** - * Returns the normal Buffer of the BufferSet + * Returns the currently active Buffer of the BufferSet */ public get active(): Buffer { return this._activeBuffer; } /** - * Returns the currently active Buffer of the BufferSet + * Returns the normal Buffer of the BufferSet */ public get normal(): Buffer { return this._normal; From 559b6950b2ba4318ca44948350779e5f364a5f58 Mon Sep 17 00:00:00 2001 From: greenmashimaro Date: Tue, 23 Aug 2022 15:09:52 +0800 Subject: [PATCH 4/6] remove unnecessary eslint comments --- src/browser/LocalizableStrings.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/browser/LocalizableStrings.ts b/src/browser/LocalizableStrings.ts index c0a904cb..e34eaa48 100644 --- a/src/browser/LocalizableStrings.ts +++ b/src/browser/LocalizableStrings.ts @@ -3,8 +3,5 @@ * @license MIT */ -// eslint-disable-next-line prefer-const -export let promptLabel = 'Terminal input'; - -// eslint-disable-next-line prefer-const -export let tooMuchOutput = 'Too much output to announce, navigate to rows manually to read'; +export const promptLabel = 'Terminal input'; +export const tooMuchOutput = 'Too much output to announce, navigate to rows manually to read'; From ac81d3f72dd6a57e169dbf57b2942a7d1f87eadf Mon Sep 17 00:00:00 2001 From: greenmashimaro Date: Wed, 24 Aug 2022 22:41:45 +0800 Subject: [PATCH 5/6] feat: restore LocalizableStrings.ts const export --- src/browser/LocalizableStrings.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/browser/LocalizableStrings.ts b/src/browser/LocalizableStrings.ts index e34eaa48..fcf677c0 100644 --- a/src/browser/LocalizableStrings.ts +++ b/src/browser/LocalizableStrings.ts @@ -3,5 +3,12 @@ * @license MIT */ -export const promptLabel = 'Terminal input'; -export const tooMuchOutput = 'Too much output to announce, navigate to rows manually to read'; +/* + * note: intentional design, it's exposed to embedders of xterm.js + * so they can change the strings to localize xterm.js. #4055 + */ +// eslint-disable-next-line prefer-const +export let promptLabel = 'Terminal input'; + +// eslint-disable-next-line prefer-const +export let tooMuchOutput = 'Too much output to announce, navigate to rows manually to read'; From 86ba6cd2882fb0dfff2ac151b6f75f0a2bac76d5 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 24 Aug 2022 08:55:11 -0700 Subject: [PATCH 6/6] Tweak comment --- src/browser/LocalizableStrings.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/browser/LocalizableStrings.ts b/src/browser/LocalizableStrings.ts index fcf677c0..d8bcc2c6 100644 --- a/src/browser/LocalizableStrings.ts +++ b/src/browser/LocalizableStrings.ts @@ -3,10 +3,8 @@ * @license MIT */ -/* - * note: intentional design, it's exposed to embedders of xterm.js - * so they can change the strings to localize xterm.js. #4055 - */ +// This file contains strings that get exported in the API so they can be localized + // eslint-disable-next-line prefer-const export let promptLabel = 'Terminal input';