macOS: enable copy only when there’s actual selected text

pull/12521/head
Lukas 2026-04-29 19:33:09 +02:00
parent 6590196661
commit 6fdca6bb53
No known key found for this signature in database
GPG Key ID: 1944A0A77B561220
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
}