From 430306d5729bd5342ebc3132389c63073a8ca2aa Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 12 Apr 2020 13:02:05 -0400 Subject: [PATCH] Fix not consistently scrolling to the active line. --- CHANGES | 1 + Source/BSSourceView.mm | 3 ++- Source/DebuggerController.m | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index f1450eb..25c4daa 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ MacGDBp CHANGE LOG ##################### - Fix: Crash when selecting stack frames after disconnecting. - Fix: Expanded variables would not reliably re-open after debugger steps. +- Fix: Would not consistently scroll to the active line. 2.0.1 ##################### diff --git a/Source/BSSourceView.mm b/Source/BSSourceView.mm index 048dd3a..287fd9d 100644 --- a/Source/BSSourceView.mm +++ b/Source/BSSourceView.mm @@ -128,7 +128,6 @@ forRange:NSMakeRange(rangeIndex - 1, 0)]; [textView_ scrollRangeToVisible:[[textView_ string] lineRangeForRange:NSMakeRange(lineStart, lineEnd - lineStart)]]; - [scrollView_ setNeedsDisplay:YES]; } /** @@ -257,6 +256,8 @@ NSString* ColorHEXStringINIDirective(NSString* directive, NSColor* color) { [self->ruler_ performLayout]; + [self scrollToLine:self->markedLine_]; + if (handler) handler(); }); diff --git a/Source/DebuggerController.m b/Source/DebuggerController.m index 6e14057..e0c1178 100644 --- a/Source/DebuggerController.m +++ b/Source/DebuggerController.m @@ -323,20 +323,21 @@ NSString* filename = [[NSURL URLWithString:frame.filename] path]; if ([filename isEqualToString:@""]) return; - - // Replace the source if necessary. - if (frame.source && ![_sourceViewer.file isEqualToString:filename]) - { - [_sourceViewer setString:frame.source asFile:filename]; - + + if (![_sourceViewer.file isEqualToString:filename]) { + // Replace the source if necessary. + if (frame.source) { + [_sourceViewer setString:frame.source asFile:filename]; + } else { + [_sourceViewer setFile:filename]; + } + NSSet* breakpoints = [_model.breakpointManager breakpointsForFile:filename]; [_sourceViewer setMarkers:breakpoints]; } - + [_sourceViewer setMarkedLine:frame.lineNumber]; [_sourceViewer scrollToLine:frame.lineNumber]; - - [[_sourceViewer textView] setNeedsDisplay:YES]; } /** -- 2.43.5