Fix tab switching state persistence and keypress beeps
- Add TerminalSurface class to own ghostty_surface_t lifecycle per tab - Use ZStack to keep all terminal views alive instead of recreating on switch - Add NSTextInputClient conformance to properly handle interpretKeyEvents - Add ghostty_surface_set_focus calls for proper focus management - Add doCommand(by:) override to silence unhandled key command beeps
This commit is contained in:
parent
c5bd543fe0
commit
f969298c6e
3 changed files with 333 additions and 120 deletions
|
|
@ -15,13 +15,14 @@ struct ContentView: View {
|
|||
.fill(Color(nsColor: .separatorColor))
|
||||
.frame(width: 1)
|
||||
|
||||
// Terminal Content
|
||||
if let selectedId = tabManager.selectedTabId,
|
||||
let tab = tabManager.tabs.first(where: { $0.id == selectedId }) {
|
||||
GhosttyTerminalView()
|
||||
.id(tab.id)
|
||||
} else {
|
||||
Color(nsColor: .windowBackgroundColor)
|
||||
// Terminal Content - use ZStack to keep all surfaces alive
|
||||
ZStack {
|
||||
ForEach(tabManager.tabs) { tab in
|
||||
let isActive = tabManager.selectedTabId == tab.id
|
||||
GhosttyTerminalView(terminalSurface: tab.terminalSurface, isActive: isActive)
|
||||
.opacity(isActive ? 1 : 0)
|
||||
.allowsHitTesting(isActive)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(minWidth: 800, minHeight: 600)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue