From cd06c2e508842d8fb468812fbad0040a69ba96af Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 17 Jan 2025 08:07:35 +0800 Subject: [PATCH] R-app: update to 1.79 for ppc --- math/R-app/Portfile | 25 +- ...rect-function-calls-to-Obj-C-methods.patch | 374 ++++++++++++++++++ ...rt-suppress-IsMenuKeyEvent-in-stderr.patch | 72 ++++ ...Revert-add-blank-touchbar-to-console.patch | 59 +++ ...Expected-min-height-of-view-macOS-wa.patch | 39 ++ ...4-RDocumentWinCtrl.m-fix-compilation.patch | 34 ++ ...tEditorTextStorage.m-fix-compilation.patch | 25 ++ 7 files changed, 620 insertions(+), 8 deletions(-) create mode 100644 math/R-app/files/0001-Revert-remove-direct-function-calls-to-Obj-C-methods.patch create mode 100644 math/R-app/files/0001-Revert-suppress-IsMenuKeyEvent-in-stderr.patch create mode 100644 math/R-app/files/0002-Revert-add-blank-touchbar-to-console.patch create mode 100644 math/R-app/files/0003-Revert-Suppress-Expected-min-height-of-view-macOS-wa.patch create mode 100644 math/R-app/files/0004-RDocumentWinCtrl.m-fix-compilation.patch create mode 100644 math/R-app/files/0005-RScriptEditorTextStorage.m-fix-compilation.patch diff --git a/math/R-app/Portfile b/math/R-app/Portfile index 679bbf11b8091..dfb6dc423f7a5 100644 --- a/math/R-app/Portfile +++ b/math/R-app/Portfile @@ -17,9 +17,9 @@ if {${os.platform} eq "darwin" && ${os.major} > 12} { worksrcdir Mac-GUI } else { # Version for older systems, including PPC. 1.73 still builds but freezes on quit. - version 1.72 - set rel_r_ver 4.0.2 - revision 4 + version 1.79 + set rel_r_ver 4.3.0 + revision 0 } categories math science aqua maintainers {me.com:kjell.konis @kjellpk} {i0ntempest @i0ntempest} openmaintainer @@ -32,7 +32,8 @@ homepage http://R.research.att.com/ platforms macosx master_sites http://cran.rstudio.com/bin/macosx/ \ - http://cran.us.r-project.org/bin/macosx/ + http://cran.us.r-project.org/bin/macosx/ \ + https://cran.csie.ntu.edu.tw/bin/macosx/ distname Mac-GUI-${version} @@ -45,9 +46,9 @@ if {${os.platform} eq "darwin" && ${os.major} > 12} { size 1399999 } else { checksums ${distname}.tar.gz \ - rmd160 022ddae8a3988c5a33928d520742ddfca73ac21d \ - sha256 a30c97b37645b55aff62bc88cccaf92c307f1e84d84d3ecd5c1333afa2b78e76 \ - size 1311627 + rmd160 44518e071c8e220dd02071ba0ded7899fc5c8924 \ + sha256 10eff30befa2b60a880d5a8f08f81a941cd447fee5f37fccf54b422299870267 \ + size 1299278 } if {${os.platform} eq "darwin" && ${os.major} < 11} { @@ -76,13 +77,21 @@ if {${os.platform} eq "darwin" && ${os.major} < 11} { move ${workpath}/Mac-GUI-${legacy_ver}/ja.lproj ${worksrcpath} move ${workpath}/Mac-GUI-${legacy_ver}/nl.lproj ${worksrcpath} } + # 1.79 + patchfiles-append 0001-Revert-suppress-IsMenuKeyEvent-in-stderr.patch + # 1.76 + patchfiles-append 0001-Revert-remove-direct-function-calls-to-Obj-C-methods.patch \ + 0002-Revert-add-blank-touchbar-to-console.patch \ + 0003-Revert-Suppress-Expected-min-height-of-view-macOS-wa.patch \ + 0004-RDocumentWinCtrl.m-fix-compilation.patch \ + 0005-RScriptEditorTextStorage.m-fix-compilation.patch post-patch { # These are intended for 1.72 (see above). Other versions set different compatibility. if {${os.major} == 9} { reinplace "s|Xcode 3.2|Xcode 3.1|g" ${worksrcpath}/R.xcodeproj/project.pbxproj } - reinplace "s|MACOSX_DEPLOYMENT_TARGET = 10.11|MACOSX_DEPLOYMENT_TARGET = ${macosx_deployment_target}|g" ${worksrcpath}/R.xcodeproj/project.pbxproj + reinplace "s|MACOSX_DEPLOYMENT_TARGET = 10.13|MACOSX_DEPLOYMENT_TARGET = ${macosx_deployment_target}|g" ${worksrcpath}/R.xcodeproj/project.pbxproj } } diff --git a/math/R-app/files/0001-Revert-remove-direct-function-calls-to-Obj-C-methods.patch b/math/R-app/files/0001-Revert-remove-direct-function-calls-to-Obj-C-methods.patch new file mode 100644 index 0000000000000..b575e35d585c3 --- /dev/null +++ b/math/R-app/files/0001-Revert-remove-direct-function-calls-to-Obj-C-methods.patch @@ -0,0 +1,374 @@ +From ec81778b56a48ce204033a9ca2e02a515c13a88d Mon Sep 17 00:00:00 2001 +From: Sergey Fedorov +Date: Fri, 17 Jan 2025 06:43:01 +0800 +Subject: [PATCH 1/5] Revert "remove direct function calls to Obj-C methods" + +This reverts commit 19d6a0cfa9cc5a4aa6539c07ade6c62a3b60dd6b. +--- + NoodleLineNumberView.h | 10 ++++++++++ + NoodleLineNumberView.m | 26 ++++++++++++++++++++------ + RController.h | 4 ++++ + RController.m | 31 ++++++++++++++++++++++--------- + RScriptEditorGlyphGenerator.h | 3 +++ + RScriptEditorGlyphGenerator.m | 16 ++++++++++++++++ + RScriptEditorTextStorage.h | 7 +++++++ + RScriptEditorTextStorage.m | 18 ++++++++++++------ + RScriptEditorTypeSetter.h | 1 + + RScriptEditorTypeSetter.m | 8 ++++++-- + 10 files changed, 101 insertions(+), 23 deletions(-) + +diff --git NoodleLineNumberView.h NoodleLineNumberView.h +index f0f3a0f..33773a2 100644 +--- NoodleLineNumberView.h ++++ NoodleLineNumberView.h +@@ -74,6 +74,16 @@ static inline id NSArrayObjectAtIndex(NSArray *self, NSUInteger i) + // Add support for selection by clicking/dragging + NSUInteger dragSelectionStartLine; + ++ SEL lineNumberForCharacterIndexSel; ++ IMP lineNumberForCharacterIndexIMP; ++ SEL lineRangeForRangeSel; ++ SEL numberWithUnsignedIntegerSel; ++ IMP numberWithUnsignedIntegerIMP; ++ SEL addObjectSel; ++ IMP addObjectIMP; ++ SEL rangeOfLineSel; ++ Class numberClass; ++ + NSLayoutManager *layoutManager; + NSTextContainer *container; + NSTextView *clientView; +diff --git NoodleLineNumberView.m NoodleLineNumberView.m +index 308bed5..afe71a0 100644 +--- NoodleLineNumberView.m ++++ NoodleLineNumberView.m +@@ -97,8 +97,18 @@ + [self updateGutterThicknessConstants]; + currentRuleThickness = 0.0f; + ++ // Cache loop methods for speed ++ lineNumberForCharacterIndexSel = @selector(lineNumberForCharacterIndex:); ++ lineNumberForCharacterIndexIMP = [self methodForSelector:lineNumberForCharacterIndexSel]; ++ lineRangeForRangeSel = @selector(lineRangeForRange:); ++ addObjectSel = @selector(addObject:); ++ numberWithUnsignedIntegerSel = @selector(numberWithUnsignedInteger:); ++ numberWithUnsignedIntegerIMP = [NSNumber methodForSelector:numberWithUnsignedIntegerSel]; ++ rangeOfLineSel = @selector(getLineStart:end:contentsEnd:forRange:); ++ + currentNumberOfLines = 1; + lineWrapping = NO; ++ numberClass = [NSNumber class]; + + normalBackgroundColor = [[NSColor colorWithCalibratedWhite: 0.95 alpha: 1.0] retain]; + foldedBackgroundColor = [[NSColor colorWithCalibratedWhite: 0.85 alpha: 1.0] retain]; +@@ -282,7 +292,7 @@ + // It doesn't show up in the glyphs so would not be accounted for. + range.length++; + +- for (line = [self lineNumberForCharacterIndex: range.location]; line < count; line++) ++ for (line = (NSUInteger)(*lineNumberForCharacterIndexIMP)(self, lineNumberForCharacterIndexSel, range.location); line < count; line++) + { + + rects = [layoutManager rectArrayForCharacterRange:NSMakeRange([NSArrayObjectAtIndex(lines, line) unsignedIntegerValue], 0) +@@ -386,7 +396,7 @@ + BOOL flipped = [self isFlipped]; + + +- for (line = [self lineNumberForCharacterIndex: range.location]; line < count; line++) ++ for (line = (NSUInteger)(*lineNumberForCharacterIndexIMP)(self, lineNumberForCharacterIndexSel, range.location); line < count; line++) + { + index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue]; + +@@ -777,17 +787,21 @@ + + index = 0; + ++ // Cache loop methods for speed ++ IMP rangeOfLineIMP = [textString methodForSelector:rangeOfLineSel]; ++ addObjectIMP = [lineIndices methodForSelector:addObjectSel]; ++ + do + { +- [lineIndices addObject: [NSNumber numberWithUnsignedInteger: index]]; +- [textString getLineStart:NULL end:&index contentsEnd:NULL forRange:NSMakeRange(index, 0)]; ++ (void)(*addObjectIMP)(lineIndices, addObjectSel, (*numberWithUnsignedIntegerIMP)(numberClass, numberWithUnsignedIntegerSel, index)); ++ (*rangeOfLineIMP)(textString, rangeOfLineSel, NULL, &index, NULL, NSMakeRange(index, 0)); + } + while (index < stringLength); + + // Check if text ends with a new line. +- [textString getLineStart:NULL end:&lineEnd contentsEnd:&contentEnd forRange:NSMakeRange([[lineIndices lastObject] intValue], 0)]; ++ (*rangeOfLineIMP)(textString, rangeOfLineSel, NULL, &lineEnd, &contentEnd, NSMakeRange([[lineIndices lastObject] intValue], 0)); + if (contentEnd < lineEnd) +- [lineIndices addObject: [NSNumber numberWithUnsignedInteger: index]]; ++ (void)(*addObjectIMP)(lineIndices, addObjectSel, (*numberWithUnsignedIntegerIMP)(numberClass, numberWithUnsignedIntegerSel, index)); + + NSUInteger lineCount = [lineIndices count]; + if(lineCount < 100) +diff --git RController.h RController.h +index 0fba2c8..1648ead 100644 +--- RController.h ++++ RController.h +@@ -92,6 +92,10 @@ + WebView *currentWebViewForFindAction; + id searchInWebViewWindow; + ++ IMP _nextEventImp; ++ IMP _sendEventImp; ++ IMP _doProcessImp; ++ + NSTimer *timer; + NSTimer *RLtimer; + NSTimer *Flushtimer; +diff --git RController.m RController.m +index 12df46b..0c19f7e 100644 +--- RController.m ++++ RController.m +@@ -115,6 +115,10 @@ int R_SetOptionWidth(int); + + static RController* sharedRController; + ++static SEL _nextEventSel; ++static SEL _sendEventSel; ++static SEL _doProcessSel; ++ + static inline const char* NSStringUTF8String(NSString* self) + { + typedef const char* (*SPUTF8StringMethodPtr)(NSString*, SEL); +@@ -212,6 +216,14 @@ static inline const char* NSStringUTF8String(NSString* self) + + filteredHistory = nil; + ++ _nextEventSel = @selector(nextEventMatchingMask:untilDate:inMode:dequeue:); ++ _sendEventSel = @selector(sendEvent:); ++ _doProcessSel = @selector(doProcessEvents:); ++ ++ _nextEventImp = [NSApp methodForSelector:_nextEventSel]; ++ _sendEventImp = [NSApp methodForSelector:_sendEventSel]; ++ _doProcessImp = [self methodForSelector:_doProcessSel]; ++ + specialCharacters = [[NSCharacterSet characterSetWithCharactersInString:@"\r\b\a"] retain]; + + [[NSNotificationCenter defaultCenter] addObserver:self +@@ -1402,7 +1414,7 @@ extern BOOL isTimeToFinish; + + while ([consoleInputQueue count]==0) { + processingEvents = NO; // we should be at the top level, so for sanity reasons make sure we always process events +- [self doProcessEvents: YES]; ++ (_doProcessImp)(self, _doProcessSel, YES); + } + + currentConsoleInput = [consoleInputQueue objectAtIndex:0]; +@@ -1703,8 +1715,9 @@ extern BOOL isTimeToFinish; + // to be processed in all cases, even if system was called from within + // the event handler and as such can run recursively + NSEvent *event; +- if((event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate dateWithTimeIntervalSinceNow:0.05] inMode:NSDefaultRunLoopMode dequeue:YES])) +- [NSApp sendEvent: event]; ++ if((event = (_nextEventImp)(NSApp, _nextEventSel, NSAnyEventMask, [NSDate dateWithTimeIntervalSinceNow:0.05], NSDefaultRunLoopMode, YES))) ++ (_sendEventImp)(NSApp, _sendEventSel, event); ++ + } + if(breakPending) { + kill(pid, SIGINT); +@@ -3100,11 +3113,11 @@ outputType: 0 = stdout, 1 = stderr, 2 = stdout/err as root + #ifdef USE_POOLS + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + #endif +- if (blocking) +- [NSApp sendEvent: [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES]]; +- else { +- while((event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate dateWithTimeIntervalSinceNow:0.0001] inMode:NSDefaultRunLoopMode dequeue:YES])) +- [NSApp sendEvent: event]; ++ if (blocking){ ++ (_sendEventImp)(NSApp, _sendEventSel, (_nextEventImp)(NSApp, _nextEventSel, NSAnyEventMask, [NSDate distantFuture], NSDefaultRunLoopMode, YES)); ++ } else { ++ while((event = (_nextEventImp)(NSApp, _nextEventSel, NSAnyEventMask, [NSDate dateWithTimeIntervalSinceNow:0.0001], NSDefaultRunLoopMode, YES))) ++ (_sendEventImp)(NSApp, _sendEventSel, event); + } + #ifdef USE_POOLS + [pool release]; +@@ -3132,7 +3145,7 @@ outputType: 0 = stdout, 1 = stderr, 2 = stdout/err as root + + - (void) handleProcessEvents + { +- [self doProcessEvents: NO]; ++ (_doProcessImp)(self, _doProcessSel, NO); + } + + +diff --git RScriptEditorGlyphGenerator.h RScriptEditorGlyphGenerator.h +index c9cab1e..80251cc 100644 +--- RScriptEditorGlyphGenerator.h ++++ RScriptEditorGlyphGenerator.h +@@ -42,6 +42,9 @@ + id _destination; + RScriptEditorTextStorage *theTextStorage; + NSGlyph nullGlyph; ++ IMP _attrStrImp; ++ IMP _foldImp; ++ IMP _foldindImp; + NSInteger sizeOfNSGlyph; + + } +diff --git RScriptEditorGlyphGenerator.m RScriptEditorGlyphGenerator.m +index 464769c..82d0ab6 100644 +--- RScriptEditorGlyphGenerator.m ++++ RScriptEditorGlyphGenerator.m +@@ -38,13 +38,27 @@ + #import "RScriptEditorLayoutManager.h" + #import "PreferenceKeys.h" + ++static SEL _attrStrSel; ++static SEL _foldSel; ++static SEL _foldindSel; ++ + @implementation RScriptEditorGlyphGenerator + +++ (void)initialize ++{ ++ if ([self class] == [RScriptEditorGlyphGenerator class]) { ++ _attrStrSel = @selector(attributedString); ++ _foldSel = @selector(foldedRangeAtIndex:); ++ _foldindSel = @selector(foldedForIndicatorAtIndex:); ++ } ++} ++ + - (id)init + { + self = [super init]; + + if (self != nil) { ++ _attrStrImp = [self methodForSelector:_attrStrSel]; + nullGlyph = NSNullGlyph; + sizeOfNSGlyph = sizeof(NSGlyph); + } +@@ -61,6 +75,8 @@ + { + if(theTextStorage) [theTextStorage release]; + theTextStorage = [textStorage retain]; ++ _foldImp = [theTextStorage methodForSelector:_foldSel]; ++ _foldindImp = [theTextStorage methodForSelector:_foldindSel]; + } + + - (void)generateGlyphsForGlyphStorage:(id )glyphStorage desiredNumberOfCharacters:(NSUInteger)nChars glyphIndex:(NSUInteger *)glyphIndex characterIndex:(NSUInteger *)charIndex +diff --git RScriptEditorTextStorage.h RScriptEditorTextStorage.h +index f04f993..2879ca9 100644 +--- RScriptEditorTextStorage.h ++++ RScriptEditorTextStorage.h +@@ -46,6 +46,13 @@ + + id selfDelegate; + ++ IMP _getImp; ++ IMP _setImp; ++ IMP _strImp; ++ IMP _replImp; ++ IMP _editImp; ++ IMP _getlImp; ++ + } + + - (id)initWithDelegate:(id)theDelegate; +diff --git RScriptEditorTextStorage.m RScriptEditorTextStorage.m +index e52d397..65d9844 100644 +--- RScriptEditorTextStorage.m ++++ RScriptEditorTextStorage.m +@@ -77,6 +77,12 @@ static SEL _getlSel; + + if (self != nil) { + _attributedString = [[NSTextStorage alloc] init]; ++ _getImp = [_attributedString methodForSelector:_getSel]; ++ _setImp = [_attributedString methodForSelector:_setSel]; ++ _strImp = [_attributedString methodForSelector:_strSel]; ++ _replImp = [_attributedString methodForSelector:_replSel]; ++ _editImp = [self methodForSelector:_editSel]; ++ _getlImp = [_attributedString methodForSelector:_getlSel]; + + selfDelegate = (RScriptEditorTextView*)theDelegate; + [self setDelegate:theDelegate]; +@@ -298,13 +304,13 @@ static SEL _getlSel; + + - (NSString *)string + { +- return _attributedString ? [_attributedString string] : nil; ++ return (*_strImp)(_attributedString, _strSel); + } + + - (NSDictionary *)attributesAtIndex:(NSUInteger)location effectiveRange:(NSRangePointer)range + { + +- NSDictionary *attributes = [_attributedString attributesAtIndex:location effectiveRange:range]; ++ NSDictionary *attributes = (*_getImp)(_attributedString, _getSel, location, range); + + if(!foldedCounter || location > [_attributedString length]) return attributes; + +@@ -375,14 +381,14 @@ static SEL _getlSel; + // NSMutableAttributedString primitives + - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str + { +- [_attributedString replaceCharactersInRange:range withString:str]; +- [self edited:NSTextStorageEditedCharacters range:range changeInLength: [str length] - range.length]; ++ (*_replImp)(_attributedString, _replSel, range, str); ++ (*_editImp)(self, _editSel, NSTextStorageEditedCharacters, range, [str length] - range.length); + } + + - (void)setAttributes:(NSDictionary *)attrs range:(NSRange)range + { +- [_attributedString setAttributes:attrs range:range]; +- [self edited:NSTextStorageEditedAttributes range:range changeInLength:0]; ++ (*_setImp)(_attributedString, _setSel, attrs, range); ++ (*_editImp)(self, _editSel, NSTextStorageEditedAttributes, range, 0); + } + + // Attribute Fixing Overrides +diff --git RScriptEditorTypeSetter.h RScriptEditorTypeSetter.h +index a53688f..ded33e9 100644 +--- RScriptEditorTypeSetter.h ++++ RScriptEditorTypeSetter.h +@@ -42,6 +42,7 @@ + { + + RScriptEditorTextStorage *_attributedString; ++ IMP _foldImp; + + } + +diff --git RScriptEditorTypeSetter.m RScriptEditorTypeSetter.m +index e9a20c7..b49771c 100644 +--- RScriptEditorTypeSetter.m ++++ RScriptEditorTypeSetter.m +@@ -38,11 +38,14 @@ + + @implementation RScriptEditorTypeSetter + ++static SEL _foldSel; ++ + - (id)init + { + self = [super init]; + if (nil == self) return nil; + _attributedString = nil; ++ _foldSel = @selector(foldedForIndicatorAtIndex:); + return self; + } + +@@ -56,12 +59,13 @@ + { + if(_attributedString) [_attributedString release]; + _attributedString = [textStorage retain]; ++ _foldImp = [_attributedString methodForSelector:_foldSel]; ++ + } + + - (NSTypesetterControlCharacterAction)actionForControlCharacterAtIndex:(NSUInteger)charIndex + { +- if (_attributedString && [_attributedString foldedForIndicatorAtIndex:charIndex] > -1) +- return NSTypesetterZeroAdvancementAction; ++ if (_foldImp && (NSInteger)(*_foldImp)(_attributedString, _foldSel, charIndex) > -1) return NSTypesetterZeroAdvancementAction; + return [super actionForControlCharacterAtIndex:charIndex]; + } + +-- +2.48.0 + diff --git a/math/R-app/files/0001-Revert-suppress-IsMenuKeyEvent-in-stderr.patch b/math/R-app/files/0001-Revert-suppress-IsMenuKeyEvent-in-stderr.patch new file mode 100644 index 0000000000000..6381cbd13afc2 --- /dev/null +++ b/math/R-app/files/0001-Revert-suppress-IsMenuKeyEvent-in-stderr.patch @@ -0,0 +1,72 @@ +From b320e319dcbea9edcd5ececa6e80e08e8c6b0fbf Mon Sep 17 00:00:00 2001 +From: Sergey Fedorov +Date: Fri, 17 Jan 2025 07:08:50 +0800 +Subject: [PATCH 1/2] Revert "suppress IsMenuKeyEvent: in stderr" + +This reverts commit c72427be7236045a110acac62f2afa8810869020. +--- + RController.m | 41 ++++++++++++++--------------------------- + 1 file changed, 14 insertions(+), 27 deletions(-) + +diff --git RController.m RController.m +index cf493bb..db7e366 100644 +--- RController.m ++++ RController.m +@@ -2109,25 +2109,6 @@ issuing the newline. + [consoleTextView insertText:text]; + } + */ +- +-/* A bad hack to remove output from the stream - it is used to remove +- stderr output caused by buggy Apple code that we have no control over. +- It is assumed that s is allocated so if a replacement is necessary, +- it will be released and a new string allocated. +- */ +-static NSString *fixBuggyOutput(NSString *s, NSString *regExp) { +- NSRange r = [s rangeOfString:regExp options:NSRegularExpressionSearch]; +- if (r.location != NSNotFound) { +- NSString *os = s; +- NSUInteger start, end; +- [s getLineStart:&start end:&end contentsEnd:0 forRange:r]; +- s = [os stringByReplacingCharactersInRange:NSMakeRange(start, end-start) withString:@""]; +- [s retain]; +- [os release]; +- } +- return s; +-} +- + /* This function is used by two threads to write stderr and/or stdout to the console + length: -1 = the string is null-terminated + outputType: 0 = stdout, 1 = stderr, 2 = stdout/err as root +@@ -2137,14 +2118,20 @@ outputType: 0 = stdout, 1 = stderr, 2 = stdout/err as root + NSColor *color=(outputType==0)?[consoleColors objectAtIndex:iStdoutColor]:((outputType==1)?[consoleColors objectAtIndex:iStderrColor]:[consoleColors objectAtIndex:iRootColor]); + if (len>=0 && buf[len]!=0) buf[len]=0; /* this MAY be dangerous ... */ + NSString *s = [[NSString alloc] initWithUTF8String:buf]; +- if (outputType == 1) { +- // FIXME horrible, horrible hack - this warning seems to be a macOS bug, because +- // we never create NSPopoverTouchBarItemButton, so we suppress it in the console +- // by removing a line with that content +- s = fixBuggyOutput(s, @"Warning: Expected min height of view: .* to be less than or equal to "); +- /* bug in Monterey and up */ +- s = fixBuggyOutput(s, @"IsMenuKeyEvent: found no unichar data in event; retranslated without deadkeys to produce"); +- } ++ if (outputType == 1) { ++ // FIXME horrible, horrible hack - this warning seems to be a macOS bug, because ++ // we never create NSPopoverTouchBarItemButton, so we suppress it in the console ++ // by removing a line with that content ++ NSRange r = [s rangeOfString:@"Warning: Expected min height of view: .* to be less than or equal to " options:NSRegularExpressionSearch]; ++ if (r.location != NSNotFound) { ++ NSString *os = s; ++ NSUInteger start, end; ++ [s getLineStart:&start end:&end contentsEnd:0 forRange:r]; ++ s = [os stringByReplacingCharactersInRange:NSMakeRange(start, end-start) withString:@""]; ++ [s retain]; ++ [os release]; ++ } ++ } + [self flushROutput]; + [self writeConsoleDirectly:s withColor:color]; + [s release]; +-- +2.48.0 + diff --git a/math/R-app/files/0002-Revert-add-blank-touchbar-to-console.patch b/math/R-app/files/0002-Revert-add-blank-touchbar-to-console.patch new file mode 100644 index 0000000000000..9f90ed3bd174e --- /dev/null +++ b/math/R-app/files/0002-Revert-add-blank-touchbar-to-console.patch @@ -0,0 +1,59 @@ +From 90540ad3219a0841ebc38e931fa3145306861a54 Mon Sep 17 00:00:00 2001 +From: Sergey Fedorov +Date: Fri, 17 Jan 2025 06:43:46 +0800 +Subject: [PATCH 2/5] Revert "add blank touchbar to console" + +This reverts commit 445c5133f7f6ac2e39aaaf36f68e298c546a2eea. +--- + RController.m | 21 +-------------------- + 1 file changed, 1 insertion(+), 20 deletions(-) + +diff --git RController.m RController.m +index 0c19f7e..92ee414 100644 +--- RController.m ++++ RController.m +@@ -316,21 +316,6 @@ static inline const char* NSStringUTF8String(NSString* self) + } + } + +-- (NSTouchBar *)makeTouchBar +-{ +- // Create TouchBar object +- SLog(@"makeTouchBar"); +- NSTouchBar *touchBar = [[NSTouchBar alloc] init]; +- touchBar.delegate = self; +- touchBar.customizationIdentifier = @"org.R-project.R.app.console"; +- +- // Set the default ordering of items. +- touchBar.defaultItemIdentifiers = @[@"foo", NSTouchBarItemIdentifierOtherItemsProxy]; +- touchBar.customizationAllowedItemIdentifiers = @[@"foo"]; +- touchBar.principalItemIdentifier = @"foo"; +- +- return touchBar; +-} + + - (void) awakeFromNib { + +@@ -382,6 +367,7 @@ static inline const char* NSStringUTF8String(NSString* self) + [consoleTextView setContinuousSpellCheckingEnabled:NO]; // force 'no spell checker' + [[consoleTextView textStorage] setDelegate:self]; + ++ + RTextView_autoCloseBrackets = [Preferences flagForKey:kAutoCloseBrackets withDefault:YES]; + + [self setupToolbar]; +@@ -389,11 +375,6 @@ static inline const char* NSStringUTF8String(NSString* self) + [RConsoleWindow setBackgroundColor:[defaultConsoleColors objectAtIndex:iBackgroundColor]]; // we need this, because "update" doesn't touch the color if it's equal - and by default the window has *no* background - not even the default one, so we bring it in sync + [RConsoleWindow setDocumentEdited:YES]; + +- // Force essentially an empty TouchBar due to performance +- // problems with Apple's default implemenation +- [NSApplication sharedApplication].automaticCustomizeTouchBarMenuItemEnabled = YES; +- consoleTextView.touchBar = [self makeTouchBar]; +- + SLog(@" - working directory setup timer"); + WDirtimer = [NSTimer scheduledTimerWithTimeInterval:0.5 + target:self +-- +2.48.0 + diff --git a/math/R-app/files/0003-Revert-Suppress-Expected-min-height-of-view-macOS-wa.patch b/math/R-app/files/0003-Revert-Suppress-Expected-min-height-of-view-macOS-wa.patch new file mode 100644 index 0000000000000..6976a7195fb9c --- /dev/null +++ b/math/R-app/files/0003-Revert-Suppress-Expected-min-height-of-view-macOS-wa.patch @@ -0,0 +1,39 @@ +From ac6a016fdefa686fbb89cc57df3cc474c78f5e49 Mon Sep 17 00:00:00 2001 +From: Sergey Fedorov +Date: Fri, 17 Jan 2025 06:47:04 +0800 +Subject: [PATCH 3/5] Revert "Suppress 'Expected min height of view' macOS + warning" + +This reverts commit 54b786054e8776c386afad7030669890a04898b5. +--- + RController.m | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git RController.m RController.m +index 92ee414..7ada3d3 100644 +--- RController.m ++++ RController.m +@@ -2091,20 +2091,6 @@ outputType: 0 = stdout, 1 = stderr, 2 = stdout/err as root + NSColor *color=(outputType==0)?[consoleColors objectAtIndex:iStdoutColor]:((outputType==1)?[consoleColors objectAtIndex:iStderrColor]:[consoleColors objectAtIndex:iRootColor]); + if (len>=0 && buf[len]!=0) buf[len]=0; /* this MAY be dangerous ... */ + NSString *s = [[NSString alloc] initWithUTF8String:buf]; +- if (outputType == 1) { +- // FIXME horrible, horrible hack - this warning seems to be a macOS bug, because +- // we never create NSPopoverTouchBarItemButton, so we suppress it in the console +- // by removing a line with that content +- NSRange r = [s rangeOfString:@"Warning: Expected min height of view: .* to be less than or equal to " options:NSRegularExpressionSearch]; +- if (r.location != NSNotFound) { +- NSString *os = s; +- NSUInteger start, end; +- [s getLineStart:&start end:&end contentsEnd:0 forRange:r]; +- s = [os stringByReplacingCharactersInRange:NSMakeRange(start, end-start) withString:@""]; +- [s retain]; +- [os release]; +- } +- } + [self flushROutput]; + [self writeConsoleDirectly:s withColor:color]; + [s release]; +-- +2.48.0 + diff --git a/math/R-app/files/0004-RDocumentWinCtrl.m-fix-compilation.patch b/math/R-app/files/0004-RDocumentWinCtrl.m-fix-compilation.patch new file mode 100644 index 0000000000000..5362b8f3c34ca --- /dev/null +++ b/math/R-app/files/0004-RDocumentWinCtrl.m-fix-compilation.patch @@ -0,0 +1,34 @@ +From 15d4e4a6c04e9a0b8efb5f31b69160f73cc379ee Mon Sep 17 00:00:00 2001 +From: Sergey Fedorov +Date: Fri, 17 Jan 2025 06:50:17 +0800 +Subject: [PATCH 4/5] RDocumentWinCtrl.m: fix compilation + +--- + RDocumentWinCtrl.m | 11 ----------- + 1 file changed, 11 deletions(-) + +diff --git RDocumentWinCtrl.m RDocumentWinCtrl.m +index 45059c9..2d5c3fb 100644 +--- RDocumentWinCtrl.m ++++ RDocumentWinCtrl.m +@@ -410,17 +410,6 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) + + // Needed for showing tooltips of folded items + [[self window] setAcceptsMouseMovedEvents:YES]; +- +- // FIXME: this is a hack for layout issues in Big Sur +- // by forcing re-size we force layout to be updated - is there a better way? +- NSRect clRect = [[self window] contentLayoutRect]; +- clRect.size.width += 1; +- [[self window] setContentSize:clRect.size]; +- clRect.size.width -= 1; +- [[self window] setContentSize:clRect.size]; +- +- // Make the text view fist responder so the user can start typing +- [[self window] makeFirstResponder:textView]; + + SLog(@" - windowDidLoad is done"); + +-- +2.48.0 + diff --git a/math/R-app/files/0005-RScriptEditorTextStorage.m-fix-compilation.patch b/math/R-app/files/0005-RScriptEditorTextStorage.m-fix-compilation.patch new file mode 100644 index 0000000000000..699a88963d650 --- /dev/null +++ b/math/R-app/files/0005-RScriptEditorTextStorage.m-fix-compilation.patch @@ -0,0 +1,25 @@ +From 39a6c7c47c71f7f76443a8db4e918a8a09a54e75 Mon Sep 17 00:00:00 2001 +From: Sergey Fedorov +Date: Fri, 17 Jan 2025 06:56:51 +0800 +Subject: [PATCH 5/5] RScriptEditorTextStorage.m: fix compilation + +--- + RScriptEditorTextStorage.m | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git RScriptEditorTextStorage.m RScriptEditorTextStorage.m +index 65d9844..869ea72 100644 +--- RScriptEditorTextStorage.m ++++ RScriptEditorTextStorage.m +@@ -350,7 +350,7 @@ static SEL _getlSel; + + } + +-- (void)edited:(NSTextStorageEditActions)mask range:(NSRange)oldRange changeInLength:(NSInteger)lengthChange ++- (void)edited:(NSUInteger)mask range:(NSRange)oldRange changeInLength:(NSInteger)lengthChange + { + + if(foldedCounter && mask == NSTextStorageEditedCharacters) { +-- +2.48.0 +