Repository navigation
Fix terminal TUI background seam #3903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e60b062
caa37c5
39cc0fa
75b2ece
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,6 +110,54 @@ final class WindowAppearanceSnapshotTests: XCTestCase { | |
| XCTAssertEqual(plan.windowBackgroundColor.hexString(includeAlpha: true), "#272822FF") | ||
| } | ||
|
|
||
| func testOpaqueUnblurredTerminalBackgroundIsRendererOwned() { | ||
| let snapshot = makeSnapshot( | ||
| unifySurfaceBackdrops: false, | ||
| backgroundOpacity: 1.0, | ||
| backgroundBlur: .disabled | ||
| ) | ||
| let policy = snapshot.policy(for: .windowRoot) | ||
|
|
||
| XCTAssertNil(policy.hostLayerBackgroundColor) | ||
| guard case let .ghosttyTerminalBackdrop(_, _, renderingMode) = policy else { | ||
| XCTFail("expected terminal backdrop policy") | ||
| return | ||
| } | ||
| XCTAssertEqual(renderingMode, .ghosttyRendererOwnedBackgroundImage) | ||
| } | ||
|
Comment on lines
+113
to
+127
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new test verifies the opaque+unblurred → renderer-owned direction, but the inverse paths — translucent opacity → host-layer, and
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed by adding inverse regression assertions for translucent and blurred terminal backgrounds staying host-layer-owned. — Claude Code |
||
|
|
||
| func testTranslucentTerminalBackgroundStaysHostLayerOwned() { | ||
| let snapshot = makeSnapshot( | ||
| unifySurfaceBackdrops: false, | ||
| backgroundOpacity: 0.9, | ||
| backgroundBlur: .disabled | ||
| ) | ||
| let policy = snapshot.policy(for: .windowRoot) | ||
|
|
||
| XCTAssertNotNil(policy.hostLayerBackgroundColor) | ||
| guard case let .ghosttyTerminalBackdrop(_, _, renderingMode) = policy else { | ||
| XCTFail("expected terminal backdrop policy") | ||
| return | ||
| } | ||
| XCTAssertEqual(renderingMode, .windowHostBackdrop) | ||
| } | ||
|
|
||
| func testBlurredTerminalBackgroundStaysHostLayerOwned() { | ||
| let snapshot = makeSnapshot( | ||
| unifySurfaceBackdrops: false, | ||
| backgroundOpacity: 1.0, | ||
| backgroundBlur: .radius(20) | ||
| ) | ||
| let policy = snapshot.policy(for: .windowRoot) | ||
|
|
||
| XCTAssertNotNil(policy.hostLayerBackgroundColor) | ||
| guard case let .ghosttyTerminalBackdrop(_, _, renderingMode) = policy else { | ||
| XCTFail("expected terminal backdrop policy") | ||
| return | ||
| } | ||
| XCTAssertEqual(renderingMode, .windowHostBackdrop) | ||
| } | ||
|
|
||
| func testDebugBackgroundGlassUsesWindowGlassPhase() { | ||
| let snapshot = makeSnapshot( | ||
| unifySurfaceBackdrops: false, | ||
|
|
@@ -137,7 +185,10 @@ final class WindowAppearanceSnapshotTests: XCTestCase { | |
| terminalBackgroundColor: NSColor(hex: "#272822") ?? .black, | ||
| terminalBackgroundOpacity: backgroundOpacity, | ||
| terminalBackgroundBlur: backgroundBlur, | ||
| terminalRenderingMode: .windowHostBackdrop, | ||
| terminalRenderingMode: WindowAppearanceSnapshot.terminalRenderingMode( | ||
| backgroundOpacity: Double(backgroundOpacity), | ||
| backgroundBlur: backgroundBlur | ||
| ), | ||
| unifySurfaceBackdrops: unifySurfaceBackdrops, | ||
| sidebarSettings: SidebarBackdropSettingsSnapshot( | ||
| materialRawValue: SidebarMaterialOption.sidebar.rawValue, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runtime config changes leave rendering mode stale
Medium Severity
The
GHOSTTY_ACTION_CONFIG_CHANGEhandler callsupdateDefaultBackground(which updates stored opacity/blur) but never recalculatesusesHostLayerBackground. Previously this was safe becauseusesHostLayerBackgroundwas alwaystrue. Now that the initialization paths dynamically set it tofalsefor opaque unblurred backgrounds, a runtime config change that transitions opacity from opaque to translucent leaves the flag stale atfalse, causingWindowAppearanceSnapshot.current(...)to produce a snapshot withterminalRenderingMode = .ghosttyRendererOwnedBackgroundImagewhen it needs.windowHostBackdrop.Additional Locations (1)
Sources/GhosttyTerminalView.swift#L2251-L2255Reviewed by Cursor Bugbot for commit 75b2ece. Configure here.