Fix initial cursor insertion location with paragraph alignment setting

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38228 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2014-12-04 16:02:07 +00:00
parent fd815172ac
commit 3f1b7cb970

View file

@ -884,6 +884,8 @@ has the same y origin and height as the line frag rect it is in.
if (glyph_index == (unsigned int)-1)
{ /* No information is available. Get default font height. */
NSFont *f = [_typingAttributes objectForKey:NSFontAttributeName];
NSParagraphStyle *paragraph = [_typingAttributes objectForKey: NSParagraphStyleAttributeName];
NSTextAlignment alignment = [paragraph alignment];
/* will be -1 if there are no text containers */
*textContainer = num_textcontainers - 1;
@ -893,6 +895,17 @@ has the same y origin and height as the line frag rect it is in.
tc = textcontainers + num_textcontainers - 1;
r.origin.x += [tc->textContainer lineFragmentPadding];
}
// Apply left/right/center justification...
if (alignment == NSRightTextAlignment)
{
r.origin.x += [[self firstTextView] frame].size.width;
}
else if (alignment == NSCenterTextAlignment)
{
r.origin.x += [[self firstTextView] frame].size.width / 2;
}
return r;
}
fraction_through = 1.0;