Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJeffrey Stedfast <jestedfa@microsoft.com>2019-10-29 21:20:03 +0300
committerGitHub <noreply@github.com>2019-10-29 21:20:03 +0300
commitc06ff7293674f919dae30ad44a0b6b4aac3ced14 (patch)
treea1e26dfd370394211a9ec40d8f6aa87707874226 /main
parent05d83cb8f55ac924da54a3ce67ddf905581cac84 (diff)
parent339d0852324990938bd2168edbf8ba15dd21b7d7 (diff)
Merge pull request #9126 from mono/pr-sandy-pinned-watch-scrolling
[Debugger] Prevent pinned watches from disappearing during scroll/etc
Diffstat (limited to 'main')
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchAdornmentManager.cs49
1 files changed, 33 insertions, 16 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchAdornmentManager.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchAdornmentManager.cs
index 51539ac2cc..27feca882b 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchAdornmentManager.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/PinnedWatches/PinnedWatchAdornmentManager.cs
@@ -64,7 +64,7 @@ namespace MonoDevelop.Debugger.VSTextView.PinnedWatches
this.cocoaViewFactory = cocoaViewFactory;
this.textView = textView;
- //this.textView.LayoutChanged += OnTextViewLayoutChanged;
+ this.textView.LayoutChanged += OnTextViewLayoutChanged;
if (DebuggingService.IsDebugging) {
RenderAllAdornments ();
@@ -102,11 +102,16 @@ namespace MonoDevelop.Debugger.VSTextView.PinnedWatches
adornments.Remove (e.Watch);
}
- void RenderAdornment (PinnedWatch watch)
+ SnapshotSpan GetSnapshotSpan (PinnedWatch watch)
{
var newSpan = textView.TextSnapshot.SpanFromMDColumnAndLine (watch.Line, watch.Column, watch.EndLine, watch.EndColumn);
var trackingSpan = textView.TextSnapshot.CreateTrackingSpan (newSpan, SpanTrackingMode.EdgeInclusive);
- var span = trackingSpan.GetSpan (textView.TextSnapshot);
+ return trackingSpan.GetSpan (textView.TextSnapshot);
+ }
+
+ void RenderAdornment (PinnedWatch watch)
+ {
+ var span = GetSnapshotSpan (watch);
if (textView.TextViewLines == null)
return;
@@ -123,19 +128,33 @@ namespace MonoDevelop.Debugger.VSTextView.PinnedWatches
var view = (NSView) materialView;
view.WantsLayer = true;
+ UpdateAdornmentLayout (watch, view, span);
+
+ adornments [watch] = view;
+ }
+
+ void UpdateAdornmentLayout (PinnedWatch watch, NSView view, SnapshotSpan span)
+ {
try {
+ if (!textView.TextViewLines.IntersectsBufferSpan (span)) {
+ layer.RemoveAdornment (view);
+ return;
+ }
+
var charBound = textView.TextViewLines.GetCharacterBounds (span.End);
var origin = new CGPoint (
Math.Round (charBound.Left),
Math.Round (charBound.TextTop + charBound.TextHeight / 2 - view.Frame.Height / 2));
view.SetFrameOrigin (origin);
+
+ if (view.Superview == null || view.VisibleRect () == CGRect.Empty) {
+ layer.RemoveAdornment (view);
+ layer.AddAdornment (XPlatAdornmentPositioningBehavior.TextRelative, span, watch, view, null);
+ }
} catch (Exception ex) {
view.SetFrameOrigin (default);
LoggingService.LogInternalError ("https://vsmac.dev/923058", ex);
}
-
- layer.AddAdornment (XPlatAdornmentPositioningBehavior.TextRelative, span, watch, view, null);
- adornments[watch] = view;
}
void RenderAllAdornments ()
@@ -163,16 +182,14 @@ namespace MonoDevelop.Debugger.VSTextView.PinnedWatches
debugging = false;
}
- //void OnTextViewLayoutChanged (object sender, TextViewLayoutChangedEventArgs e)
- //{
- // if (!DebuggingService.IsDebugging)
- // return;
-
- // layer.RemoveAllAdornments ();
- // adornments.Clear ();
+ void OnTextViewLayoutChanged (object sender, TextViewLayoutChangedEventArgs e)
+ {
+ if (!DebuggingService.IsDebugging)
+ return;
- // RenderAllAdornments ();
- //}
+ foreach (var adornmentPair in adornments)
+ UpdateAdornmentLayout (adornmentPair.Key, adornmentPair.Value, GetSnapshotSpan(adornmentPair.Key));
+ }
public void Dispose ()
{
@@ -184,7 +201,7 @@ namespace MonoDevelop.Debugger.VSTextView.PinnedWatches
DebuggingService.PinnedWatches.WatchRemoved -= OnWatchRemoved;
DebuggingService.DebugSessionStarted -= OnDebugSessionStarted;
DebuggingService.StoppedEvent -= OnDebuggingSessionStopped;
- //textView.LayoutChanged -= OnTextViewLayoutChanged;
+ textView.LayoutChanged -= OnTextViewLayoutChanged;
}
}
}