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 setLastLineNumberParsed: NSNotFound];
}
[debugger updateEditor];
}
}
return PCDBAsyncStatusRecord;

View file

@ -59,6 +59,7 @@ NSString *PCBreakMethod = @"BreakMethod";
NSString *PCBreakFilename = @"BreakFilename";
NSString *PCBreakLineNumber = @"BreakLineNumber";
NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
NSString *PCUpdateEditorNotification = @"PCUpdateEditorNotification";
@implementation PCDebugger
+ (void) initialize
@ -305,6 +306,15 @@ NSString *PCDBDebuggerStartedNotification = @"PCDBDebuggerStartedNotification";
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
- (void) interrupt
{

View file

@ -225,6 +225,12 @@
highlited_chars[1] = -1;
undoManager = [[NSUndoManager alloc] init];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(processNotification:)
name: @"PCUpdateEditorNotification"
object: nil];
}
return self;
@ -410,6 +416,18 @@
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
// ===========================================================================