macOS: enable copy only when there’s actual selected text (#12521)

This matches the `peformable` definition and the default behaviors of
text editing on macOS.
pull/12026/head
Mitchell Hashimoto 2026-04-30 06:41:04 -07:00 committed by GitHub
commit 1623daf21c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -2121,6 +2121,14 @@ extension Ghostty.SurfaceView: NSMenuItemValidation {
item.state = readonly ? .on : .off
return true
case #selector(copy(_:)):
// We only enable copy menu item when there're actual selected text
if let text = self.accessibilitySelectedText(), text.count > 0 {
return true
} else {
return false
}
default:
return true
}