darling icon indicating copy to clipboard operation
darling copied to clipboard

Escape Codes Are Visible In ``NSFeatureUnsupportedError`` Error Dialog

Open TheBrokenRail opened this issue 4 years ago • 0 comments

Expected Result The escape codes are displayed as the characters they represent.

Actual Result They appear verbatim.

error

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];
}
  1. Compile The Program
  2. Launch The Program
  3. 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

TheBrokenRail avatar May 28 '21 11:05 TheBrokenRail