Try to add notifications so that editor changes appropriately

This commit is contained in:
Gregory John Casamento 2021-07-08 07:35:24 -04:00
parent 41e33c7d54
commit d283fd04b1
3 changed files with 29 additions and 0 deletions

View file

@ -425,6 +425,7 @@
[debugger setLastFileNameParsed: nil]; [debugger setLastFileNameParsed: nil];
[debugger setLastLineNumberParsed: NSNotFound]; [debugger setLastLineNumberParsed: NSNotFound];
} }
[debugger updateEditor];
} }
} }
return PCDBAsyncStatusRecord; return PCDBAsyncStatusRecord;

View file

@ -59,6 +59,7 @@ NSString *PCBreakMethod = @"BreakMethod";
NSString *PCBreakFilename = @"BreakFilename"; NSString *PCBreakFilename = @"BreakFilename";
NSString *PCBreakLineNumber = @"BreakLineNumber"; NSString *PCBreakLineNumber = @"BreakLineNumber";
NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification"; NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
NSString *PCUpdateEditorNotification = @"PCUpdateEditorNotification";
@implementation PCDebugger @implementation PCDebugger
+ (void) initialize + (void) initialize
@ -305,6 +306,15 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
lastLineNumberParsed = num; lastLineNumberParsed = num;
} }
- (void) updateEditor
{
NSNumber *n = [NSNumber numberWithInteger: lastLineNumberParsed];
NSDictionary *d = [NSDictionary dictionaryWithObjectsAndKeys:
lastFileNameParsed, @"LastFileName", n, @"LastLineNumber", nil];
[NOTIFICATION_CENTER postNotificationName: PCUpdateEditorNotification
object: d];
}
// kill process // kill process
- (void) interrupt - (void) interrupt
{ {

View file

@ -225,6 +225,12 @@
highlited_chars[1] = -1; highlited_chars[1] = -1;
undoManager = [[NSUndoManager alloc] init]; undoManager = [[NSUndoManager alloc] init];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(processNotification:)
name: @"PCUpdateEditorNotification"
object: nil];
} }
return self; return self;
@ -410,6 +416,18 @@
object:self]; object:self];
} }
- (void) processNotification: (NSNotification *)notification
{
NSDictionary *d = [notification object];
NSString *fileName = [d objectForKey: @"lastFileName"];
NSNumber *line = [d objectForKey: @"lastLineNumber"];
NSUInteger l = [line integerValue];
[self openFileAtPath: fileName
editorManager: _editorManager
editable: YES];
[self scrollToLineNumber: l];
}
// =========================================================================== // ===========================================================================
// ==== CodeEditor protocol // ==== CodeEditor protocol
// =========================================================================== // ===========================================================================