NSTextView, showDefinition..., and _NSShowDefinitionByHotKey on Snow Leopard
NSTextView, showDefinition..., and _NSShowDefinitionByHotKey on Snow Leopard
- Subject: NSTextView, showDefinition..., and _NSShowDefinitionByHotKey on Snow Leopard
- From: Steve Shepard <email@hidden>
- Date: Mon, 12 Oct 2009 14:12:54 -0700
Hi All,
I'm looking for suggestions for debugging an issue I'm seeing with the
Control-Command-D "Lookup in Dictionary" shortcut in NSTextView on
Snow Leopard (10.6.1) .
The Problem:
When I execute the shortcut on Snow Leopard in a subclass of
NSTextView that is part of a paged layout configuration (similar to
Text Edit), the result is that the dictionary overlay pops up over a
word other than the selected word with the definition for that word
(that is, the WRONG WORD). Often, but not always, the dictionary
overlay pops up over the last word in the container. This is not
problem on Leopard or Tiger.
What I've Tried:
I've tried selecting the same word, right-clicking, and selecting
"Lookup in Dictionary." This works as expected: the dictionary overlay
pops up in the right place with the correct word selected. Note: the
default operation for this menu item is to open the dictionary
application (NSDefinitionPresentationTypeDictionaryApplication). To
cause it to pop up the dictionary overlay
(NSDefinitionPresentationTypeOverlay), open Preferences window in the
Dictionary application and select the "Contextual menu: Opens
Dictionary panel" radio button.
It looks like the "Lookup in Dictionary" context menu target calls the
new showDefinitionForAttributedString:range:options:baselineOriginProvider:
call. However, the Control-Command-D key equivalent seems to bypass
this API and call the private _NSShowDefinitionByHotKey function
instead.
I haven't yet discovered the API point(s) in NSTextView that
_NSShowDefinitionByHotKey calls back into. I've tried overriding (and
setting breakpoints on):
* the rangeFor... methods
* the rangesFor... methods
* the 10.6 showDefinitionForAttributedString:range:options:baselineOriginProvider:
* the 10.6 showDefinitionForAttributedString:atPoint: method
* the private _lookUpDefiniteRangeInDictionaryFromMenu: and
_lookUpIndefiniteRangeInDictionaryFromMenu: methods
* the private showDefinitionByHotKey method.
No luck.
I am NOT able to reproduce this in Text Edit and believe that this is
my bug, but am scratching my head at this point.
Anyone have suggestions. Aki?
BTW, I can work around this by overriding performKeyEquivalent and
calling showDefinitionForAttributedString:range:options:baselineOriginProvider:
-Steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden