From 0f0c615748a33cca70c6c2a5aea2385a3dbf7b66 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 26 May 2026 07:11:49 -0700 Subject: [PATCH] Use BufferLine translation for search logical text rebuild. This reduces per-cell work in cold-cache searches by using the optimized line translation path while preserving match behavior. Co-authored-by: Cursor --- addons/addon-search/src/SearchAddon.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/addons/addon-search/src/SearchAddon.ts b/addons/addon-search/src/SearchAddon.ts index 4bfd6d325..fb069d52a 100644 --- a/addons/addon-search/src/SearchAddon.ts +++ b/addons/addon-search/src/SearchAddon.ts @@ -376,17 +376,10 @@ export class SearchAddon extends Disposable implements ITerminalAddon, ISearchAp return ''; } const textParts: string[] = []; - const cell = terminal.buffer.active.getNullCell(); + const blankLine = ' '.repeat(cols); for (const row of rows) { const line = terminal.buffer.active.getLine(row); - for (let x = 0; x < cols; x++) { - const loadedCell = line?.getCell(x, cell); - const width = loadedCell ? loadedCell.getWidth() : 1; - if (width === 0) { - continue; - } - textParts.push(loadedCell?.getChars() || ' '); - } + textParts.push(line ? line.translateToString(false, 0, cols) : blankLine); } return textParts.join(''); }