Fix the detection of ANSI code
This commit is contained in:
parent
c9acccaddc
commit
eab3342065
1 changed files with 4 additions and 4 deletions
|
@ -106,7 +106,7 @@
|
|||
@implementation NSString (ANSI)
|
||||
|
||||
- (BOOL)containsANSICodes {
|
||||
return [self rangeOfString:@"\\033["].location != NSNotFound;
|
||||
return [self rangeOfString:@"\033["].location != NSNotFound;
|
||||
}
|
||||
|
||||
- (NSMutableAttributedString*)attributedStringParsingANSICodes {
|
||||
|
@ -114,10 +114,10 @@
|
|||
|
||||
base::scoped_nsobject<NSMutableDictionary> attributes(
|
||||
[[NSMutableDictionary alloc] init]);
|
||||
NSArray* parts = [self componentsSeparatedByString:@"\\033["];
|
||||
NSArray* parts = [self componentsSeparatedByString:@"\033["];
|
||||
[result appendAttributedString:[[[NSAttributedString alloc]
|
||||
initWithString:parts.firstObject
|
||||
attributes:nil] autorelease]];
|
||||
initWithString:parts.firstObject
|
||||
attributes:nil] autorelease]];
|
||||
|
||||
for (NSString* part in [parts subarrayWithRange:NSMakeRange(1, parts.count - 1)]) {
|
||||
if (part.length == 0)
|
||||
|
|
Loading…
Reference in a new issue