Skip to content

Commit 328c6d6

Browse files
committed
Sync focus state unconditionally in createSurface
Per review feedback: always call ghostty_surface_set_focus(createdSurface, lastFocusState) instead of only syncing when !lastFocusState. This avoids coupling to Ghostty's default focused=true and is more robust if the upstream default ever changes.
1 parent 3490dd9 commit 328c6d6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Sources/GhosttyTerminalView.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,12 +3549,12 @@ final class TerminalSurface: Identifiable, ObservableObject {
35493549
}
35503550
}
35513551

3552-
// Ghostty surfaces default to focused=true. If this surface was logically
3553-
// unfocused before the C surface existed (e.g. during layout restoration),
3554-
// sync the desired state now so non-focused panes don't show a focused cursor.
3555-
if !lastFocusState {
3556-
ghostty_surface_set_focus(createdSurface, false)
3557-
}
3552+
// Sync the desired focus state to the newly created C surface. Ghostty
3553+
// surfaces default to focused=true, but this surface may have been
3554+
// logically unfocused before the C surface existed (e.g. during layout
3555+
// restoration). Always sync unconditionally so we don't couple to
3556+
// Ghostty's default.
3557+
ghostty_surface_set_focus(createdSurface, lastFocusState)
35583558

35593559
NotificationCenter.default.post(
35603560
name: .terminalSurfaceDidBecomeReady,

0 commit comments

Comments
 (0)