mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 12:00:58 +00:00
(-fixParagraphStyleAttributeInRange:): Handle paragraphs with paragraph styles set for part of it correctly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17134 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a8236e46af
commit
974395db91
2 changed files with 28 additions and 10 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2003-07-05 17:20 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
|
* Source/NSAttributedString.m (-fixParagraphStyleAttributeInRange:):
|
||||||
|
Handle paragraphs with a paragraph style set for a part of it but
|
||||||
|
not the first character correctly.
|
||||||
|
|
||||||
|
* Source/NSFont.m (getNSFont): Retain/autorelease when returning a
|
||||||
|
cached instance to make the retain status of the instance correct.
|
||||||
|
|
||||||
2003-07-05 16:07 Alexander Malmberg <alexander@malmberg.org>
|
2003-07-05 16:07 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Source/NSFont.m (-initWithCoder:): Make sure that the returned
|
* Source/NSFont.m (-initWithCoder:): Make sure that the returned
|
||||||
|
|
|
@ -883,6 +883,11 @@ documentAttributes: (NSDictionary **)dict
|
||||||
}
|
}
|
||||||
// FIXME: Should check for each character if it is supported by the
|
// FIXME: Should check for each character if it is supported by the
|
||||||
// assigned font
|
// assigned font
|
||||||
|
/*
|
||||||
|
Note that this needs to be done on a script basis. Per-character checks
|
||||||
|
are difficult to do at all, don't give reasonable results, and would have
|
||||||
|
really poor performance.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) fixParagraphStyleAttributeInRange: (NSRange)range
|
- (void) fixParagraphStyleAttributeInRange: (NSRange)range
|
||||||
|
@ -918,10 +923,18 @@ documentAttributes: (NSDictionary **)dict
|
||||||
the range without the style set. */
|
the range without the style set. */
|
||||||
if ((NSMaxRange (found) + 1) < end)
|
if ((NSMaxRange (found) + 1) < end)
|
||||||
{
|
{
|
||||||
/* This skips the range with style not set, and attempts
|
/* There is a paragraph style for part of the paragraph. Set
|
||||||
again to set the style for the whole paragraph taking
|
this style for the entire paragraph.
|
||||||
the style at the first location with a style set. */
|
|
||||||
loc = NSMaxRange (found) + 1;
|
Since NSMaxRange(found) + 1 is outside the longest effective
|
||||||
|
range for the nil style, it must be non-nil.
|
||||||
|
*/
|
||||||
|
style = [self attribute: NSParagraphStyleAttributeName
|
||||||
|
atIndex: NSMaxRange(found) + 1
|
||||||
|
effectiveRange: NULL];
|
||||||
|
[self addAttribute: NSParagraphStyleAttributeName
|
||||||
|
value: style
|
||||||
|
range: r];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -930,9 +943,6 @@ documentAttributes: (NSDictionary **)dict
|
||||||
[self addAttribute: NSParagraphStyleAttributeName
|
[self addAttribute: NSParagraphStyleAttributeName
|
||||||
value: [NSParagraphStyle defaultParagraphStyle]
|
value: [NSParagraphStyle defaultParagraphStyle]
|
||||||
range: r];
|
range: r];
|
||||||
|
|
||||||
/* Move on to the next paragraph. */
|
|
||||||
loc = end;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -948,12 +958,11 @@ documentAttributes: (NSDictionary **)dict
|
||||||
value: style
|
value: style
|
||||||
range: found];
|
range: found];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Move on to the next paragraph. */
|
/* Move on to the next paragraph. */
|
||||||
loc = end;
|
loc = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) fixAttachmentAttributeInRange: (NSRange)aRange
|
- (void) fixAttachmentAttributeInRange: (NSRange)aRange
|
||||||
|
|
Loading…
Reference in a new issue