From 80140d9be2f15bdbb3314da4bea4ab99004a3c8d Mon Sep 17 00:00:00 2001 From: Amolith Date: Sun, 21 Dec 2025 16:44:50 -0700 Subject: [PATCH] fix(body): preserve indented lines as preformatted Lines starting with 4+ spaces or a tab are now preserved verbatim, fixing code block formatting in commit bodies. Before: task.Method1() task.Method2() Would become "task.Method1() task.Method2()" after reflowing. Assisted-by: Claude Opus 4.5 via Crush --- wrapBody.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wrapBody.go b/wrapBody.go index 3c0ac3291f5e99736d6890bc6114e173745549ef..37fbe72808ae44180cb328e6789ff8c3023d4f9d 100644 --- a/wrapBody.go +++ b/wrapBody.go @@ -26,6 +26,12 @@ func formatBody(body string) (string, error) { } for _, line := range lines { + // Preserve indented lines (4+ spaces or tab) as preformatted code + if strings.HasPrefix(line, " ") || strings.HasPrefix(line, "\t") { + result = append(result, line) + continue + } + trimmed := strings.TrimSpace(line) if trimmed == "" { flushPlainText()