mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-04 22:30:41 +00:00
Don't count sublists as a separate list item
This commit is contained in:
parent
65ee82565d
commit
b00f6e5526
2 changed files with 14 additions and 21 deletions
|
@ -1110,7 +1110,6 @@ documentAttributes: (NSDictionary **)dict
|
||||||
|
|
||||||
NSCharacterSet *newlineCharacterSet = [NSCharacterSet newlineCharacterSet];
|
NSCharacterSet *newlineCharacterSet = [NSCharacterSet newlineCharacterSet];
|
||||||
|
|
||||||
BOOL isNested = NO;
|
|
||||||
NSUInteger itemNumber = 1;
|
NSUInteger itemNumber = 1;
|
||||||
NSUInteger index;
|
NSUInteger index;
|
||||||
for (index=1; index<length; index++)
|
for (index=1; index<length; index++)
|
||||||
|
@ -1125,12 +1124,6 @@ documentAttributes: (NSDictionary **)dict
|
||||||
if ([list isEqual: [textLists lastObject]])
|
if ([list isEqual: [textLists lastObject]])
|
||||||
{
|
{
|
||||||
itemNumber++;
|
itemNumber++;
|
||||||
isNested = NO;
|
|
||||||
}
|
|
||||||
else if (!isNested && [textLists containsObject: list])
|
|
||||||
{
|
|
||||||
itemNumber++;
|
|
||||||
isNested = YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer[index-1] == '\r' && buffer[index] == '\n')
|
if (buffer[index-1] == '\r' && buffer[index] == '\n')
|
||||||
|
|
|
@ -41,19 +41,19 @@ int main(int argc, char **argv)
|
||||||
[storage appendAttributedString:
|
[storage appendAttributedString:
|
||||||
[[NSMutableAttributedString alloc] initWithString: @"item 3\n" attributes: attrs1]];
|
[[NSMutableAttributedString alloc] initWithString: @"item 3\n" attributes: attrs1]];
|
||||||
|
|
||||||
NSUInteger index4A = [storage length];
|
NSUInteger index4 = [storage length];
|
||||||
[storage appendAttributedString:
|
[storage appendAttributedString:
|
||||||
[[NSMutableAttributedString alloc] initWithString: @"item 4A\n" attributes: attrs2]];
|
[[NSMutableAttributedString alloc] initWithString: @"subitem 1\n" attributes: attrs2]];
|
||||||
|
|
||||||
NSUInteger index4B = [storage length];
|
|
||||||
[storage appendAttributedString:
|
|
||||||
[[NSMutableAttributedString alloc] initWithString: @"item 4B\n" attributes: attrs2]];
|
|
||||||
|
|
||||||
NSUInteger index5 = [storage length];
|
NSUInteger index5 = [storage length];
|
||||||
[storage appendAttributedString:
|
[storage appendAttributedString:
|
||||||
[[NSMutableAttributedString alloc] initWithString: @"item 5\n" attributes: attrs1]];
|
[[NSMutableAttributedString alloc] initWithString: @"subitem 2\n" attributes: attrs2]];
|
||||||
|
|
||||||
NSUInteger index6 = [storage length];
|
NSUInteger index6 = [storage length];
|
||||||
|
[storage appendAttributedString:
|
||||||
|
[[NSMutableAttributedString alloc] initWithString: @"item 4\n" attributes: attrs1]];
|
||||||
|
|
||||||
|
NSUInteger index7 = [storage length];
|
||||||
[storage appendAttributedString:
|
[storage appendAttributedString:
|
||||||
[[NSMutableAttributedString alloc] initWithString: @"extra text\n" attributes: attrs3]];
|
[[NSMutableAttributedString alloc] initWithString: @"extra text\n" attributes: attrs3]];
|
||||||
|
|
||||||
|
@ -61,15 +61,15 @@ int main(int argc, char **argv)
|
||||||
pass([storage itemNumberInTextList: list1 atIndex: index2] == 2, "Index with CR+LF sequence");
|
pass([storage itemNumberInTextList: list1 atIndex: index2] == 2, "Index with CR+LF sequence");
|
||||||
pass([storage itemNumberInTextList: list1 atIndex: index3 - 1] == 2, "Index on boundary");
|
pass([storage itemNumberInTextList: list1 atIndex: index3 - 1] == 2, "Index on boundary");
|
||||||
pass([storage itemNumberInTextList: list1 atIndex: index3] == 3, "Index for third list item");
|
pass([storage itemNumberInTextList: list1 atIndex: index3] == 3, "Index for third list item");
|
||||||
pass([storage itemNumberInTextList: list1 atIndex: index4A] == 4, "Index for fourth list item, A");
|
pass([storage itemNumberInTextList: list1 atIndex: index4] == 3, "Index for third list item (sublist 1)");
|
||||||
pass([storage itemNumberInTextList: list1 atIndex: index4B] == 4, "Index for fourth list item, B");
|
pass([storage itemNumberInTextList: list1 atIndex: index5] == 3, "Index for third list item (sublist 2");
|
||||||
pass([storage itemNumberInTextList: list1 atIndex: index5] == 5, "Index for fifth list item");
|
pass([storage itemNumberInTextList: list1 atIndex: index6] == 4, "Index for fifth list item");
|
||||||
|
|
||||||
pass([storage itemNumberInTextList: list2 atIndex: index4A] == 1, "Index for first sublist item");
|
pass([storage itemNumberInTextList: list2 atIndex: index4] == 1, "Index for first sublist item");
|
||||||
pass([storage itemNumberInTextList: list2 atIndex: index4B] == 2, "Index for second sublist item");
|
pass([storage itemNumberInTextList: list2 atIndex: index5] == 2, "Index for second sublist item");
|
||||||
|
|
||||||
pass([storage itemNumberInTextList: list2 atIndex: index1] == 0, "Index in other list is zero");
|
pass([storage itemNumberInTextList: list2 atIndex: index1] == 0, "Index in other list is zero");
|
||||||
pass([storage itemNumberInTextList: list1 atIndex: index6] == 0, "Index in nonlist is zero");
|
pass([storage itemNumberInTextList: list1 atIndex: index7] == 0, "Index in nonlist is zero");
|
||||||
|
|
||||||
END_SET("NSAttributedString itemNumberInTextList:atIndex: category method");
|
END_SET("NSAttributedString itemNumberInTextList:atIndex: category method");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue