Merge pull request #2029 from ghostty-org/macos-reset

macos: add "Reset Terminal" context menu option
This commit is contained in:
Mitchell Hashimoto
2024-08-01 15:08:32 -07:00
committed by GitHub
3 changed files with 13 additions and 0 deletions

View File

@ -614,6 +614,11 @@ class TerminalController: NSWindowController, NSWindowDelegate,
ghostty.toggleTerminalInspector(surface: surface)
}
@objc func resetTerminal(_ sender: Any) {
guard let surface = focusedSurface?.surface else { return }
ghostty.resetTerminal(surface: surface)
}
//MARK: - TerminalViewDelegate
func focusedSurfaceDidChange(to: Ghostty.SurfaceView?) {

View File

@ -241,6 +241,13 @@ extension Ghostty {
}
}
func resetTerminal(surface: ghostty_surface_t) {
let action = "reset"
if (!ghostty_surface_binding_action(surface, action, UInt(action.count))) {
logger.warning("action failed action=\(action)")
}
}
#if os(iOS)
// MARK: Ghostty Callbacks (iOS)

View File

@ -951,6 +951,7 @@ extension Ghostty {
menu.addItem(withTitle: "Split Down", action: #selector(TerminalController.splitDown(_:)), keyEquivalent: "")
menu.addItem(.separator())
menu.addItem(withTitle: "Reset Terminal", action: #selector(TerminalController.resetTerminal(_:)), keyEquivalent: "")
menu.addItem(withTitle: "Toggle Terminal Inspector", action: #selector(TerminalController.toggleTerminalInspector(_:)), keyEquivalent: "")
return menu