Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 09e8eac

Browse files
enhance bookmark tooltips: allow breakpoint tooltip to be displayed even if CurrentLineBookmark is on the same line.
1 parent 3409a32 commit 09e8eac

5 files changed

Lines changed: 23 additions & 2 deletions

File tree

src/AddIns/Debugger/Debugger.AddIn/Breakpoints/BreakpointBookmark.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ public override string ToString()
152152
return string.Format("{0} @{1}", this.FileName, this.LineNumber);
153153
}
154154

155+
public override bool DisplaysTooltip {
156+
get { return true; }
157+
}
158+
155159
public override object CreateTooltipContent()
156160
{
157161
return new BreakpointEditorPopup(this) {

src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/IconBarMargin.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System;
2020
using System.Collections.Generic;
2121
using System.Diagnostics;
22+
using System.Linq;
2223
using System.Windows;
2324
using System.Windows.Controls;
2425
using System.Windows.Controls.Primitives;
@@ -286,7 +287,10 @@ void MouseHover(object sender, MouseEventArgs e)
286287

287288
int line = GetLineFromMousePosition(e);
288289
if (line < 1) return;
289-
IBookmark bm = GetBookmarkFromLine(line);
290+
IBookmark bm = manager.Bookmarks
291+
.Where(m => m.LineNumber == line && m.DisplaysTooltip)
292+
.OrderBy(m => m.ZOrder)
293+
.FirstOrDefault();
290294
if (bm == null) return;
291295
object content = bm.CreateTooltipContent();
292296
popupToolTip = content as Popup;
@@ -301,7 +305,7 @@ void MouseHover(object sender, MouseEventArgs e)
301305
e.Handled = true;
302306
popupToolTip.IsOpen = true;
303307
distanceToPopupLimit = double.PositiveInfinity; // reset limit; we'll re-calculate it on the next mouse movement
304-
} else {
308+
} else if (content != null) {
305309
if (toolTip == null) {
306310
toolTip = new ToolTip();
307311
toolTip.Closed += ToolTipClosed;

src/Main/Base/Project/Editor/Bookmarks/BookmarkBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ public virtual void Drop(int lineNumber)
195195
{
196196
}
197197

198+
public virtual bool DisplaysTooltip {
199+
get { return false; }
200+
}
201+
198202
public virtual object CreateTooltipContent()
199203
{
200204
return null;

src/Main/Base/Project/Editor/Bookmarks/EntityBookmark.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ void IBookmark.Drop(int lineNumber)
9898
throw new NotSupportedException();
9999
}
100100

101+
bool IBookmark.DisplaysTooltip {
102+
get { return false; }
103+
}
104+
101105
object IBookmark.CreateTooltipContent()
102106
{
103107
return null;

src/Main/Base/Project/Editor/Bookmarks/IBookmark.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public interface IBookmark
6161
/// </summary>
6262
void Drop(int lineNumber);
6363

64+
/// <summary>
65+
/// Gets whether this bookmark might want to display a tooltip.
66+
/// </summary>
67+
bool DisplaysTooltip { get; }
68+
6469
/// <summary>
6570
/// Creates the tooltip content for the bookmark.
6671
/// </summary>

0 commit comments

Comments
 (0)