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.
This commit is contained in:
Mitchell Hashimoto
2026-04-30 06:41:04 -07:00
committed by GitHub

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
}