From 94871d99496168b697ce98d19f286c3f493399c9 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 1 Dec 2008 18:56:01 -0500 Subject: [PATCH] We need to keep variables expanded across changing stack positions * Source/DebuggerController.m: (setRegister:): Removed (tableViewSelectionDidChange:): Call [expandRegisters] (expandVariables): New private method * Source/DebuggerController.h: Header updates --- Source/DebuggerController.h | 1 - Source/DebuggerController.m | 43 ++++++++++++++++--------------------- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/Source/DebuggerController.h b/Source/DebuggerController.h index 2d87323..0bbbf5d 100644 --- a/Source/DebuggerController.h +++ b/Source/DebuggerController.h @@ -43,7 +43,6 @@ - (void)resetDisplays; - (void)setError:(NSString *)anError; -- (void)setRegister:(NSXMLDocument *)reg; - (IBAction)run:(id)sender; - (IBAction)stepIn:(id)sender; diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index c4265ef..c201ffd 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -23,6 +23,7 @@ @interface DebuggerController (Private) - (void)updateSourceViewer; - (void)updateStackViewer; +- (void)expandVariables; @end @implementation DebuggerController @@ -129,31 +130,6 @@ [self setError:[[notif userInfo] valueForKey:@"NSString"]]; } -/** - * Sets the stack root element so that the NSOutlineView can display it - */ -- (void)setRegister:(NSXMLDocument *)elm -{ - // XXX: Doing anything short of this will cause bindings to crash spectacularly for no reason whatsoever, and - // in seemingly arbitrary places. The class that crashes is _NSKeyValueObservationInfoCreateByRemoving. - // http://boredzo.org/blog/archives/2006-01-29/have-you-seen-this-crash says that this means nothing is - // being observed, but I doubt that he was using an NSOutlineView which seems to be one f!cking piece of - // sh!t when used with NSTreeController. http://www.cocoadev.com/index.pl?NSTreeControllerBugOrDeveloperError - // was the inspiration for this fix (below) but the author says that inserting does not work too well, but - // that's okay for us as we just need to replace the entire thing. - [registerController setContent:nil]; - [registerController setContent:[[elm rootElement] children]]; - - for (int i = 0; i < [registerView numberOfRows]; i++) - { - NSTreeNode *node = [registerView itemAtRow:i]; - if ([expandedRegisters containsObject:[[node representedObject] fullname]]) - { - [registerView expandItem:node]; - } - } -} - /** * Forwards the message to run script execution to the connection */ @@ -213,6 +189,7 @@ - (void)tableViewSelectionDidChange:(NSNotification *)notif { [self updateSourceViewer]; + [self expandVariables]; } /** @@ -273,6 +250,22 @@ { [stackArrayController rearrangeObjects]; [stackArrayController setSelectionIndex:0]; + [self expandVariables]; +} + +/** + * Expands the variables based on the stored set + */ +- (void)expandVariables +{ + for (int i = 0; i < [registerView numberOfRows]; i++) + { + NSTreeNode *node = [registerView itemAtRow:i]; + if ([expandedRegisters containsObject:[[node representedObject] fullname]]) + { + [registerView expandItem:node]; + } + } } #pragma mark BSSourceView Delegate -- 2.43.5