From 28b62a5e0b7dbe6a67d5888b6e22b40591dab2e8 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sat, 27 Dec 2025 14:51:07 -0800 Subject: [PATCH] Ignore soft hyphen Fixes #4961 --- src/common/InputHandler.test.ts | 5 +++++ src/common/InputHandler.ts | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/common/InputHandler.test.ts b/src/common/InputHandler.test.ts index 9de6c11c..6788d3f9 100644 --- a/src/common/InputHandler.test.ts +++ b/src/common/InputHandler.test.ts @@ -619,6 +619,11 @@ describe('InputHandler', () => { await inputHandler.parseP('¥¥¥'); assert.deepEqual(getLines(bufferService, 2), ['¥¥', '¥']); }); + it('should strip soft hyphens (U+00AD)', async () => { + await inputHandler.parseP('Soft\xadhy\xadphen'); + assert.strictEqual(bufferService.buffer.translateBufferLineToString(0, true), 'Softhyphen'); + assert.strictEqual(bufferService.buffer.x, 10); + }); }); describe('alt screen', () => { diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index 44c0275b..e6231725 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -533,6 +533,12 @@ export class InputHandler extends Disposable implements IInputHandler { for (let pos = start; pos < end; ++pos) { code = data[pos]; + // Soft hyphen's (U+00AD) behavior is ambiguous and differs across terminals. We opt to treat + // it as a zero-width hint to text layout engines and simply ignore it. + if (code === 0xAD) { + continue; + } + // get charset replacement character // charset is only defined for ASCII, therefore we only // search for an replacement char if code < 127