Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/transparent-tui-diff-tints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hunkdiff": patch
---

Preserve added and removed diff row tints when transparent background mode is enabled in the interactive TUI.
4 changes: 2 additions & 2 deletions src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { fileRowId } from "./lib/ids";
import { openSelectedFileInEditor } from "./lib/openInEditor";
import { resolveResponsiveLayout } from "./lib/responsive";
import { resizeSidebarWidth } from "./lib/sidebar";
import { availableThemes, resolveTheme, withTransparentBackground } from "./themes";
import { availableThemes, resolveTheme, withTransparentSurfaces } from "./themes";

type FocusArea = "files" | "filter" | "note";
type ActiveAddNoteTarget = ActiveAddNoteAffordance & { fileId: string };
Expand Down Expand Up @@ -166,7 +166,7 @@ export function App({
const activeTheme = useMemo(
() =>
bootstrap.input.options.transparentBackground
? withTransparentBackground(baseTheme)
? withTransparentSurfaces(baseTheme)
: baseTheme,
[baseTheme, bootstrap.input.options.transparentBackground],
);
Expand Down
34 changes: 34 additions & 0 deletions src/ui/AppHost.interactions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2752,6 +2752,40 @@ describe("App interactions", () => {
}
});

test("transparent background keeps added and removed diff row tints", async () => {
const bootstrap = createBootstrap();
bootstrap.input.options.transparentBackground = true;
const theme = resolveTheme(bootstrap.initialTheme, null);
const setup = await testRender(<AppHost bootstrap={bootstrap} />, {
width: 220,
height: 60,
});

try {
await flush(setup);

const frame = setup.captureSpans();
const lineIncludesBackground = (text: string, backgroundColor: string) =>
frame.lines.some((line) => {
const lineText = line.spans.map((span) => span.text).join("");
return (
lineText.includes(text) &&
line.spans.some(
(span) =>
capturedTestColorToHex(span.bg)?.toLowerCase() === backgroundColor.toLowerCase(),
)
);
});

expect(lineIncludesBackground("betaValue", theme.addedBg)).toBe(true);
expect(lineIncludesBackground("beta = 1", theme.removedBg)).toBe(true);
} finally {
await act(async () => {
setup.renderer.destroy();
});
}
});

test("draft note focus suppresses app shortcuts while accepting typed shortcut keys", async () => {
const setup = await testRender(<AppHost bootstrap={createBootstrap()} />, {
width: 240,
Expand Down