@@ -139,13 +139,10 @@ public func commitAsync(_ clientPtr: UnsafeMutableRawPointer, _ commit: String)
139139public func getCaretCoordinates(
140140 _ clientPtr: UnsafeMutableRawPointer ,
141141 _ followCaret: Bool ,
142- _ x: UnsafeMutablePointer < Double > ,
143- _ y: UnsafeMutablePointer < Double > ,
144- _ height: UnsafeMutablePointer < Double >
145- ) -> Bool {
142+ ) -> [ Double ] {
146143 let client : AnyObject = Unmanaged . fromOpaque ( clientPtr) . takeUnretainedValue ( )
147144 guard let client = client as? IMKTextInput else {
148- return false
145+ return [ ]
149146 }
150147 var rect = NSRect ( x: 0 , y: 0 , width: 0 , height: 0 )
151148 // n characters have n+1 caret positions, but character index only accepts 0 to n-1,
@@ -155,13 +152,13 @@ public func getCaretCoordinates(
155152 forCharacterIndex: followCaret ? ( isEnd ? u16pos - 1 : u16pos) : 0 ,
156153 lineHeightRectangle: & rect)
157154 if rect. width == 0 && rect. height == 0 {
158- return false
155+ return [ ]
159156 }
160- x . pointee = Double ( NSMinX ( rect) )
161- y . pointee = Double ( NSMinY ( rect) )
162- height. pointee = Double ( rect. height)
157+ var x = Double ( NSMinX ( rect) )
158+ let y = Double ( NSMinY ( rect) )
159+ let height = Double ( rect. height)
163160 if followCaret && isEnd {
164- x. pointee += 10
161+ x += 10
165162 }
166- return true
163+ return [ x , y , height ]
167164}
0 commit comments