Skip to content

Commit e389e66

Browse files
shivamhwpclaude
andcommitted
fix(mobile): skip the terminal config update when the theme file cannot be written
Without the temp config file the update lacked font-size and would reset the surface to defaults. The surface keeps its previous configuration until a later write succeeds. Co-Authored-By: Claude Haiku 5.5 <[email protected]>
1 parent 7879c5e commit e389e66

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎apps/mobile/modules/t3-terminal/ios/T3TerminalView.swift‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,12 +718,15 @@ public final class T3TerminalView: ExpoView, UITextFieldDelegate, UIEditMenuInte
718718
}
719719
guard let config = ghostty_config_new() else { return }
720720
defer { ghostty_config_free(config) }
721-
loadThemeConfig(into: config)
721+
let loaded = loadThemeConfig(into: config)
722722
ghostty_config_finalize(config)
723723
ghostty_app_set_color_scheme(app, appearance.ghosttyColorScheme)
724724
ghostty_surface_set_color_scheme(surface, appearance.ghosttyColorScheme)
725725
tickApp()
726-
ghostty_surface_update_config(surface, config)
726+
// Without the file, the config lacks font-size and would reset the surface to defaults.
727+
if loaded {
728+
ghostty_surface_update_config(surface, config)
729+
}
727730
resizeSurface()
728731
setNeedsLayout()
729732
}
@@ -951,11 +954,13 @@ public final class T3TerminalView: ExpoView, UITextFieldDelegate, UIEditMenuInte
951954
terminalViewport.backgroundColor = backgroundColorValue
952955
}
953956

954-
private func loadThemeConfig(into config: ghostty_config_t) {
955-
guard let path = writeThemeConfigFile() else { return }
957+
@discardableResult
958+
private func loadThemeConfig(into config: ghostty_config_t) -> Bool {
959+
guard let path = writeThemeConfigFile() else { return false }
956960
path.withCString { cString in
957961
ghostty_config_load_file(config, cString)
958962
}
963+
return true
959964
}
960965

961966
private func writeThemeConfigFile() -> String? {

0 commit comments

Comments
 (0)