mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Fix the detection of ANSI code
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user