fix(tui): preserve reasoning body indentation

This commit is contained in:
Aiden Cline 2026-05-23 21:11:10 -05:00
parent ce84bc60b2
commit 229458ebf5
2 changed files with 8 additions and 1 deletions

View file

@ -13,7 +13,7 @@ export function reasoningSummary(text: string) {
const content = text.trim()
const match = content.match(/^\*\*([^*\n]+)\*\*(?:\r?\n\r?\n|$)/)
if (!match) return { title: null, body: content }
return { title: match[1].trim(), body: content.slice(match[0].length).trim() }
return { title: match[1].trim(), body: content.slice(match[0].length).trimEnd() }
}
export function isThinkingMode(value: unknown): value is ThinkingMode {

View file

@ -16,6 +16,13 @@ describe("reasoningSummary", () => {
})
})
test("preserves markdown-significant indentation in the extracted body", () => {
expect(reasoningSummary("**Continuing Quality Review**\n\n const value = true\n")).toEqual({
title: "Continuing Quality Review",
body: " const value = true",
})
})
test("does not consume ordinary leading bold content", () => {
expect(reasoningSummary("**Important:** keep this in the body.")).toEqual({
title: null,