diff options
Diffstat (limited to 'cocoa/ScintillaView.mm')
-rw-r--r-- | cocoa/ScintillaView.mm | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 0b8fddf56..e01a2bf40 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -324,9 +324,34 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) //-------------------------------------------------------------------------------------------------- -- (NSRect) firstRectForCharacterRange: (NSRange) range -{ - return NSZeroRect; +- (NSRect) firstRectForCharacterRange: (NSRange) aRange +{ + NSRect rect; + rect.origin.x = [ScintillaView directCall: mOwner + message: SCI_POINTXFROMPOSITION + wParam: 0 + lParam: aRange.location]; + rect.origin.y = [ScintillaView directCall: mOwner + message: SCI_POINTYFROMPOSITION + wParam: 0 + lParam: aRange.location]; + int rangeEnd = aRange.location + aRange.length; + rect.size.width = [ScintillaView directCall: mOwner + message: SCI_POINTXFROMPOSITION + wParam: 0 + lParam: rangeEnd] - rect.origin.x; + rect.size.height = [ScintillaView directCall: mOwner + message: SCI_POINTYFROMPOSITION + wParam: 0 + lParam: rangeEnd] - rect.origin.y; + rect.size.height += [ScintillaView directCall: mOwner + message: SCI_TEXTHEIGHT + wParam: 0 + lParam: 0]; + rect = [[[self superview] superview] convertRect:rect toView:nil]; + rect = [self.window convertRectToScreen:rect]; + + return rect; } //-------------------------------------------------------------------------------------------------- |