From ffa9a597dc51aee47f441c346afe4280d1074f83 Mon Sep 17 00:00:00 2001 From: James Long <17031+jlongster@users.noreply.github.com> Date: Thu, 30 Jul 2026 16:09:44 +0000 Subject: [PATCH] fix(tui): fill hunk header background --- packages/tui/src/component/patch-diff.tsx | 16 +++++++------- packages/tui/src/mini/footer.permission.tsx | 1 - packages/tui/src/mini/scrollback.writer.tsx | 1 - packages/tui/src/routes/session/index.tsx | 6 ++---- .../tui/src/routes/session/permission.tsx | 3 +-- .../tui/test/component/patch-diff.test.tsx | 21 ++++++++++++++----- 6 files changed, 28 insertions(+), 20 deletions(-) diff --git a/packages/tui/src/component/patch-diff.tsx b/packages/tui/src/component/patch-diff.tsx index a56d118368..aa314354e9 100644 --- a/packages/tui/src/component/patch-diff.tsx +++ b/packages/tui/src/component/patch-diff.tsx @@ -4,14 +4,14 @@ import type { JSX } from "@opentui/solid" import { createMemo, For, Show, splitProps } from "solid-js" import { splitPatchHunks } from "../util/diff" -type Props = Omit & { +type Props = Omit & { diff: string - hunkBg: ColorInput hunkFg: ColorInput + lineNumberBg: ColorInput } export function PatchDiff(props: Props) { - const [local, diffProps] = splitProps(props, ["diff", "hunkBg", "hunkFg"]) + const [local, diffProps] = splitProps(props, ["diff", "hunkFg", "lineNumberBg"]) const hunks = createMemo(() => splitPatchHunks(local.diff)) return ( @@ -19,11 +19,13 @@ export function PatchDiff(props: Props) { {(hunk, index) => ( <> 0}> - - {hunk.header ?? ""} - + + + {hunk.header ?? ""} + + - + )} diff --git a/packages/tui/src/mini/footer.permission.tsx b/packages/tui/src/mini/footer.permission.tsx index 3e1c6c002f..4d28bbcc2c 100644 --- a/packages/tui/src/mini/footer.permission.tsx +++ b/packages/tui/src/mini/footer.permission.tsx @@ -408,7 +408,6 @@ export function RunPermissionBody(props: { > { { const frame = await app.waitForFrame((value) => value.includes("@@ -20,3 +20,3 @@"), ) - const header = frame - .split("\n") - .find((line) => line.includes("@@ -20,3 +20,3 @@")) + const headerRow = frame.split("\n").findIndex((line) => line.includes("@@ -20,3 +20,3 @@")) + const header = frame.split("\n")[headerRow] + const background = parseColor("#222222") expect(header?.startsWith("@@ -20,3 +20,3 @@")).toBe(true) expect(header?.trimEnd()).toBe("@@ -20,3 +20,3 @@") + expect( + app + .captureSpans() + .lines[headerRow].spans.every( + (span) => + span.bg.r === background.r && + span.bg.g === background.g && + span.bg.b === background.b && + span.bg.a === background.a, + ), + ).toBe(true) expect(findDiffs(app.renderer.root)).toHaveLength(2) })