Browse Source

When moving between the type and the method the TextMarker for BP was not updated

pull/263/head
Ronny Klier 14 years ago
parent
commit
92966bc3a7
  1. 22
      ILSpy.SharpDevelop.LGPL/AvalonEdit/IconBarMargin.cs

22
ILSpy.SharpDevelop.LGPL/AvalonEdit/IconBarMargin.cs

@ -282,6 +282,9 @@ namespace ICSharpCode.ILSpy.AvalonEdit
return; return;
//remove existing bookmarks and create new ones //remove existing bookmarks and create new ones
// update of existing bookmarks for new position does not update TextMarker
// this is only done in TextMarkerService handlers for BookmarkManager.Added/Removed
List<BreakpointBookmark> newBookmarks = new List<BreakpointBookmark>();
for (int i = BookmarkManager.Bookmarks.Count - 1; i >= 0; --i) { for (int i = BookmarkManager.Bookmarks.Count - 1; i >= 0; --i) {
var breakpoint = BookmarkManager.Bookmarks[i] as BreakpointBookmark; var breakpoint = BookmarkManager.Bookmarks[i] as BreakpointBookmark;
if (breakpoint == null) if (breakpoint == null)
@ -290,11 +293,8 @@ namespace ICSharpCode.ILSpy.AvalonEdit
var key = breakpoint.MemberReference.MetadataToken.ToInt32(); var key = breakpoint.MemberReference.MetadataToken.ToInt32();
if (!storage.ContainsKey(key)) if (!storage.ContainsKey(key))
{ {
// in case this was visible before
breakpoint.ImageChanged -= delegate { InvalidateVisual(); };
continue; continue;
} }
breakpoint.ImageChanged += delegate { InvalidateVisual(); };
var member = DebugInformation.DecompiledMemberReferences[key]; var member = DebugInformation.DecompiledMemberReferences[key];
@ -303,16 +303,16 @@ namespace ICSharpCode.ILSpy.AvalonEdit
member.MetadataToken.ToInt32(), breakpoint.ILRange.From, out isMatch); member.MetadataToken.ToInt32(), breakpoint.ILRange.From, out isMatch);
if (map != null) { if (map != null) {
// update bookmark BreakpointBookmark newBookmark = new BreakpointBookmark(
breakpoint.MemberReference = member; member, new AstLocation(map.SourceCodeLine, 0),
breakpoint.Location = new AstLocation(map.SourceCodeLine, 0); map.ILInstructionOffset, BreakpointAction.Break, DebugInformation.Language);
breakpoint.ILRange = map.ILInstructionOffset; newBookmark.IsEnabled = breakpoint.IsEnabled;
// Why were the breakpoints removed and recreated? newBookmarks.Add(newBookmark);
// This prevents enable/disable of breakpoints BookmarkManager.RemoveMark(breakpoint);
} }
} }
newBookmarks.ForEach(m => BookmarkManager.AddMark(m));
SyncCurrentLineBookmark(); SyncCurrentLineBookmark();
} }

Loading…
Cancel
Save