Skip to content

Commit 5b6ecc9

Browse files
committed
Fix source editor detection
1 parent 1c9d1d7 commit 5b6ecc9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Tool/Sources/AXExtension/AXUIElement.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public extension AXUIElement {
5858
}
5959

6060
var isSourceEditor: Bool {
61-
description == "Source Editor" && roleDescription != "unknown"
61+
if !(description == "Source Editor" && role != kAXUnknownRole) { return false }
62+
if let _ = firstParent(where: { $0.identifier == "editor context" }) { return true }
63+
return false
6264
}
6365

6466
var selectedTextRange: ClosedRange<Int>? {

0 commit comments

Comments
 (0)