fix: strip hashline prefixes from TUI read output (#265)

Hashline prefixes (e.g. "1#BQ:") were leaking into the TUI display
for file reads, showing as weird characters to users. Strip them
before rendering since they're only meant for model consumption.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson 2026-03-13 16:56:06 -06:00
parent ca8697ae26
commit 539262ee64

View file

@ -633,7 +633,9 @@ export class ToolExecutionComponent extends Container {
text = `${theme.fg("toolTitle", theme.bold("read"))} ${pathDisplay}`;
if (this.result) {
const output = this.getTextOutput();
const rawOutput = this.getTextOutput();
// Strip hashline prefixes (e.g. "1#BQ:content") for TUI display
const output = rawOutput.replace(/^(\s*)\d+#[ZPMQVRWSNKTXJBYH]{2}:/gm, "$1");
const rawPath = str(this.args?.file_path ?? this.args?.path);
const lang = rawPath ? getLanguageFromPath(rawPath) : undefined;
const lines = lang ? highlightCode(replaceTabs(output), lang) : output.split("\n");