darling
darling copied to clipboard
Escape Codes Are Visible In ``NSFeatureUnsupportedError`` Error Dialog
Expected Result The escape codes are displayed as the characters they represent.
Actual Result They appear verbatim.

Steps To Reproduce
#include <Cocoa/Cocoa.h>
@interface Window : NSWindow
- (instancetype) init;
- (BOOL)windowShouldClose:(id)sender;
- (IBAction) OnButton1Click:(id)sender;
@end
@implementation Window
- (instancetype) init {
NSButton *button1 = [[[NSButton alloc] initWithFrame:NSMakeRect(50, 225, 90, 25)] autorelease];
[button1 setTitle:@"button1"];
[button1 setBezelStyle:NSBezelStyleRounded];
[button1 setTarget:self];
[button1 setAction:@selector(OnButton1Click:)];
[button1 setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
[super initWithContentRect:NSMakeRect(100, 100, 300, 300) styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO];
[self setTitle:@"Button example"];
[[self contentView] addSubview:button1];
[self setIsVisible:YES];
return self;
}
- (BOOL)windowShouldClose:(id)sender {
[NSApp terminate:sender];
return YES;
}
- (IBAction) OnButton1Click:(id)sender {
NSError *error = [NSError errorWithDomain:NSCocoaErrorDomain code: NSFeatureUnsupportedError userInfo: nil];
[NSApp presentError: error];
}
@end
int main(int argc, char* argv[]) {
[NSApplication sharedApplication];
[[[[Window alloc] init] autorelease] makeMainWindow];
[NSApp run];
}
- Compile The Program
- Launch The Program
- Click The Button
Additional Information The error messages are located in https://github.com/darlinghq/darling-corefoundation/blob/master/CFError.c.
System Information Ubuntu 20.04
| Software | Version |
|---|---|
| Linux Kernel | 5.8.0-50-generic |
| Darling | 35534fcaa312b184145c95a543cf86c8b08d4e70 |