mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-23 04:06:13 +03:00
Merge pull request #2029 from ghostty-org/macos-reset
macos: add "Reset Terminal" context menu option
This commit is contained in:
@ -614,6 +614,11 @@ class TerminalController: NSWindowController, NSWindowDelegate,
|
|||||||
ghostty.toggleTerminalInspector(surface: surface)
|
ghostty.toggleTerminalInspector(surface: surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func resetTerminal(_ sender: Any) {
|
||||||
|
guard let surface = focusedSurface?.surface else { return }
|
||||||
|
ghostty.resetTerminal(surface: surface)
|
||||||
|
}
|
||||||
|
|
||||||
//MARK: - TerminalViewDelegate
|
//MARK: - TerminalViewDelegate
|
||||||
|
|
||||||
func focusedSurfaceDidChange(to: Ghostty.SurfaceView?) {
|
func focusedSurfaceDidChange(to: Ghostty.SurfaceView?) {
|
||||||
|
@ -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)
|
#if os(iOS)
|
||||||
// MARK: Ghostty Callbacks (iOS)
|
// MARK: Ghostty Callbacks (iOS)
|
||||||
|
|
||||||
|
@ -951,6 +951,7 @@ extension Ghostty {
|
|||||||
menu.addItem(withTitle: "Split Down", action: #selector(TerminalController.splitDown(_:)), keyEquivalent: "")
|
menu.addItem(withTitle: "Split Down", action: #selector(TerminalController.splitDown(_:)), keyEquivalent: "")
|
||||||
|
|
||||||
menu.addItem(.separator())
|
menu.addItem(.separator())
|
||||||
|
menu.addItem(withTitle: "Reset Terminal", action: #selector(TerminalController.resetTerminal(_:)), keyEquivalent: "")
|
||||||
menu.addItem(withTitle: "Toggle Terminal Inspector", action: #selector(TerminalController.toggleTerminalInspector(_:)), keyEquivalent: "")
|
menu.addItem(withTitle: "Toggle Terminal Inspector", action: #selector(TerminalController.toggleTerminalInspector(_:)), keyEquivalent: "")
|
||||||
|
|
||||||
return menu
|
return menu
|
||||||
|
Reference in New Issue
Block a user