From 4df899045a69f7f6e1134a3d7a761d201ff33c20 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 4 Sep 2019 10:39:46 -0400 Subject: [PATCH] Replace non-breaking spaces with normal spaces in BSSourceView. The PHP highlighter outputs  . --- CHANGES | 4 ++++ Source/BSSourceView.mm | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 24590b7..05281a8 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,10 @@ MacGDBp CHANGE LOG - Fix: #187 Non-ASCII characters would not display correctly in the source pane. - Fix: #224 Spaces in file paths were double-escaped. +- Fix: #230 Long array of objects in variable pane wraps index back to 0 + after every 32 items. +- Fix: #245 Attaching/Detaching is not always reliable. +- Fix: #246 Replace non-breaking spaces in source viewer with normal spaces. 1.5 diff --git a/Source/BSSourceView.mm b/Source/BSSourceView.mm index 741e68b..11d10b3 100644 --- a/Source/BSSourceView.mm +++ b/Source/BSSourceView.mm @@ -106,10 +106,15 @@ [[errPipe fileHandleForReading] readToEndOfFileInBackgroundAndNotify]; - NSData* data = [[outPipe fileHandleForReading] readDataToEndOfFile]; - NSAttributedString* source = [[NSAttributedString alloc] initWithHTML:data - options:@{ NSCharacterEncodingDocumentAttribute : @(NSUTF8StringEncoding) } - documentAttributes:nil]; + NSData* data = [[outPipe fileHandleForReading] readDataToEndOfFile]; + NSMutableAttributedString* source = + [[NSMutableAttributedString alloc] initWithHTML:data + options:@{ NSCharacterEncodingDocumentAttribute : @(NSUTF8StringEncoding) } + documentAttributes:nil]; + NSMutableString* stringData = [source mutableString]; + // PHP uses   in the highlighted output, which should be converted + // back to normal spaces. + [stringData replaceOccurrencesOfString:@"\u00A0" withString:@" " options:0 range:NSMakeRange(0, stringData.length)]; [[textView_ textStorage] setAttributedString:source]; [source release]; } @catch (NSException* exception) { -- 2.43.5