File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,6 +183,12 @@ public extension AXUIElement {
183183 }
184184 return all
185185 }
186+
187+ func firstParent( where match: ( AXUIElement ) -> Bool ) -> AXUIElement ? {
188+ guard let parent = self . parent else { return nil }
189+ if match ( parent) { return parent }
190+ return parent. firstParent ( where: match)
191+ }
186192
187193 func firstChild( where match: ( AXUIElement ) -> Bool ) -> AXUIElement ? {
188194 for child in children {
Original file line number Diff line number Diff line change @@ -182,6 +182,13 @@ public final class XcodeInspector: ObservableObject {
182182 runningApplication: xcode. runningApplication,
183183 element: editorElement
184184 )
185+ } else if let element = focusedElement,
186+ let editorElement = element. firstParent ( where: \. isSourceEditor)
187+ {
188+ focusedEditor = . init(
189+ runningApplication: xcode. runningApplication,
190+ element: editorElement
191+ )
185192 } else {
186193 focusedEditor = nil
187194 }
You can’t perform that action at this time.
0 commit comments