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 <cursoragent@cursor.com>
This commit is contained in:
Daniel Imms
2026-05-26 07:11:49 -07:00
co-authored by Cursor
parent 9309ccc480
commit 0f0c615748
+2 -9
View File
@@ -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('');
}