Skip to content

Commit 01c9d0f

Browse files
committed
Fix discovering hovering run in multiline
1 parent 93df16d commit 01c9d0f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Syndiesis/Controls/Editor/QuickInfoDiagnosticItem.axaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<inlines:CopyableGroupedRunInlineTextBlock
3535
Name="diagnosticMessageText"
3636
Grid.Column="2"
37-
Margin="10 7 5 0"
37+
Margin="10 7 5 7"
3838
VerticalAlignment="Top"
3939
TextWrapping="Wrap"
4040
FontSize="14"

Syndiesis/Controls/Inlines/GroupedRunInlineTextBlock.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace Syndiesis.Controls.Inlines;
77

88
public class GroupedRunInlineTextBlock : TextBlock
99
{
10+
private int? _textLength;
1011
private GroupedRunInlineCollection? _groupedInlines;
1112

1213
public GroupedRunInlineCollection? GroupedInlines
@@ -16,6 +17,7 @@ public GroupedRunInlineCollection? GroupedInlines
1617
{
1718
_groupedInlines = value;
1819
Inlines = _groupedInlines?.AsInlineCollection();
20+
_textLength = Inlines?.Text?.Length;
1921
}
2022
}
2123

@@ -31,7 +33,13 @@ public void InvalidateText()
3133

3234
var hitTest = TextLayout.HitTestPoint(point);
3335
if (!hitTest.IsInside)
34-
return default;
36+
{
37+
bool hitsCharacter = hitTest.TextPosition < _textLength;
38+
if (!hitsCharacter)
39+
{
40+
return default;
41+
}
42+
}
3543

3644
int index = hitTest.TextPosition;
3745
return GroupedRunForPosition(index);

0 commit comments

Comments
 (0)