Add missing conversion from character indexes to glyph indexes when

computing an attachment cell's frame in a text view.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31815 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2011-01-01 16:48:08 +00:00
parent 678df29a94
commit 043ca66dd9
2 changed files with 24 additions and 9 deletions

View file

@ -1,3 +1,9 @@
2011-01-01 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSTextView.m (-mouseDown:): Add missing conversion from
character indexes to glyph indexes when computing an attachment
cell's frame.
2011-01-01 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSLayoutManager.m (attachmentSize): Prevent potential

View file

@ -5239,17 +5239,26 @@ other than copy/paste or dragging. */
if (cell != nil)
{
NSRect cellFrame;
NSRect lfRect;
NSRect lfRect;
NSUInteger glyphIndex;
lfRect = [_layoutManager lineFragmentRectForGlyphAtIndex: startIndex
effectiveRange: NULL];
cellFrame.origin = [_layoutManager
locationForGlyphAtIndex: startIndex];
cellFrame.size = [_layoutManager
attachmentSizeForGlyphAtIndex: startIndex];
glyphIndex =
[_layoutManager
glyphRangeForCharacterRange: NSMakeRange(startIndex, 1)
actualCharacterRange: NULL].location;
lfRect =
[_layoutManager
lineFragmentRectForGlyphAtIndex: glyphIndex
effectiveRange: NULL];
cellFrame.origin =
[_layoutManager
locationForGlyphAtIndex: glyphIndex];
cellFrame.size =
[_layoutManager
attachmentSizeForGlyphAtIndex: glyphIndex];
cellFrame.origin.y -= cellFrame.size.height;
cellFrame.origin.x += lfRect.origin.x;
cellFrame.origin.y += lfRect.origin.y;
cellFrame.origin.x += lfRect.origin.x;
cellFrame.origin.y += lfRect.origin.y;
/* TODO: What about the insertion point ? */
if ([cell wantsToTrackMouseForEvent: theEvent