macos: enable copy/paste menu items in "Edit"

This commit is contained in:
Mitchell Hashimoto
2023-08-05 14:50:18 -07:00
parent 0bb286eeb2
commit d895887361
2 changed files with 39 additions and 2 deletions

View File

@@ -381,6 +381,23 @@ extension Ghostty {
ghostty_surface_key(surface, action, key, unmapped_key, mods)
}
// MARK: Menu Handlers
@IBAction func copy(_ sender: Any?) {
guard let surface = self.surface else { return }
ghostty_surface_binding_action(surface, GHOSTTY_BINDING_COPY_TO_CLIPBOARD, nil)
}
@IBAction func paste(_ sender: Any?) {
guard let surface = self.surface else { return }
ghostty_surface_binding_action(surface, GHOSTTY_BINDING_PASTE_FROM_CLIPBOARD, nil)
}
@IBAction func pasteAsPlainText(_ sender: Any?) {
guard let surface = self.surface else { return }
ghostty_surface_binding_action(surface, GHOSTTY_BINDING_PASTE_FROM_CLIPBOARD, nil)
}
// MARK: NSTextInputClient
func hasMarkedText() -> Bool {