* Source/NSLayoutManager.m

(_insertionPointRectForCharacterIndex:textContainer:): Fix
initial
        cursor insertion location with paragraph alignment setting.
        This patch has no visual effect as the alignment of the typing
        attributes never gets set.
        Based on patch by Marcian Lytwyn <gna@advcsi.com>.
        * Source/NSLayoutManager.m: Fix some compiler warnings.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38238 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2014-12-08 10:09:42 +00:00
parent 00928ee6ea
commit 6fc06cce3d
2 changed files with 27 additions and 4 deletions

View file

@ -1,3 +1,13 @@
2014-12-08 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSLayoutManager.m
(_insertionPointRectForCharacterIndex:textContainer:): Fix initial
cursor insertion location with paragraph alignment setting.
This patch has no visual effect as the alignment of the typing
attributes never gets set.
Based on patch by Marcian Lytwyn <gna@advcsi.com>.
* Source/NSLayoutManager.m: Fix some compiler warnings.
2014-12-07 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Additions/GNUstepGUI/GSXibLoading.h,

View file

@ -883,15 +883,28 @@ has the same y origin and height as the line frag rect it is in.
glyph_index = [self numberOfGlyphs] - 1;
if (glyph_index == (unsigned int)-1)
{ /* No information is available. Get default font height. */
NSFont *f = [_typingAttributes objectForKey:NSFontAttributeName];
NSFont *f = [_typingAttributes objectForKey: NSFontAttributeName];
/* will be -1 if there are no text containers */
*textContainer = num_textcontainers - 1;
r = NSMakeRect(0, 0, 1, [f boundingRectForFont].size.height);
if (num_textcontainers > 0)
{
NSParagraphStyle *paragraph = [_typingAttributes objectForKey: NSParagraphStyleAttributeName];
NSTextAlignment alignment = [paragraph alignment];
tc = textcontainers + num_textcontainers - 1;
r.origin.x += [tc->textContainer lineFragmentPadding];
// Apply left/right/center justification...
if (alignment == NSRightTextAlignment)
{
r.origin.x += [tc->textContainer containerSize].width;
}
else if (alignment == NSCenterTextAlignment)
{
r.origin.x += [tc->textContainer containerSize].width / 2;
}
}
return r;
}
@ -1376,7 +1389,8 @@ container
int i, j;
NSRect *rects;
NSUInteger count;
NSColor *color, *last_color;
NSColor *color = nil;
NSColor *last_color = nil;
NSGraphicsContext *ctxt = GSCurrentContext();
@ -1406,9 +1420,8 @@ container
glyph_run = run_for_glyph_index(range.location, glyphs, &glyph_pos, &char_pos);
i = range.location - glyph_pos;
last_color = nil;
first_char_pos = char_pos;
while ((glyph_run != nil) && (i + glyph_pos < range.location + range.length))
while ((glyph_run != NULL) && (i + glyph_pos < range.location + range.length))
{
NSRange r = NSMakeRange(glyph_pos + i, glyph_run->head.glyph_length - i);