mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Fixed setString: when there is no previous string, so that it uses
the typingAttributes git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10691 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9bca979b83
commit
5320d8d0ec
1 changed files with 23 additions and 5 deletions
|
@ -330,7 +330,24 @@ static NSNotificationCenter *nc;
|
|||
return;
|
||||
|
||||
[_textStorage beginEditing];
|
||||
[_textStorage replaceCharactersInRange: aRange withString: aString];
|
||||
|
||||
if (_tf.is_rich_text && [_textStorage length] == 0)
|
||||
{
|
||||
/* In this case, there is nothing in the _textStorage ... so the
|
||||
_textStorage can't choose appropriate formatting attributes
|
||||
for the string ... we want the typingAttributes to be used in
|
||||
this case. So we set the attributes manually. */
|
||||
NSAttributedString *as;
|
||||
|
||||
as = AUTORELEASE ([[NSAttributedString alloc]
|
||||
initWithString: aString
|
||||
attributes: _typingAttributes]);
|
||||
[self replaceRange: aRange withAttributedString: as];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_textStorage replaceCharactersInRange: aRange withString: aString];
|
||||
}
|
||||
[_textStorage endEditing];
|
||||
[self didChangeText];
|
||||
}
|
||||
|
@ -604,9 +621,10 @@ static NSNotificationCenter *nc;
|
|||
if (aRange.location == NSNotFound)
|
||||
return;
|
||||
|
||||
if (![self shouldChangeTextInRange: aRange
|
||||
replacementString: nil])
|
||||
return;
|
||||
if (![self shouldChangeTextInRange: aRange replacementString: nil])
|
||||
{
|
||||
return;
|
||||
}
|
||||
[_textStorage beginEditing];
|
||||
if (color != nil)
|
||||
{
|
||||
|
@ -1343,7 +1361,7 @@ static NSNotificationCenter *nc;
|
|||
if (_tf.is_rich_text)
|
||||
{
|
||||
NSDictionary *dict;
|
||||
|
||||
|
||||
if (range.location > 0)
|
||||
{
|
||||
/* If the insertion point is after a bold word, for
|
||||
|
|
Loading…
Reference in a new issue