display 0 width diagnostics

This commit is contained in:
Matt Parker
2025-08-18 20:35:47 +10:00
parent 589b1a982e
commit dfd83df76e

View File

@@ -120,7 +120,7 @@ public partial class SharpIdeCodeEdit : CodeEdit
if (line < 0 || line >= GetLineCount()) if (line < 0 || line >= GetLineCount())
return; return;
if (caretStartCol >= caretEndCol) // nothing to draw if (caretStartCol > caretEndCol) // something went wrong
return; return;
// Clamp columns to line length // Clamp columns to line length
@@ -142,12 +142,16 @@ public partial class SharpIdeCodeEdit : CodeEdit
var endPos = endRect.End; var endPos = endRect.End;
startPos.Y -= 3; startPos.Y -= 3;
endPos.Y -= 3; endPos.Y -= 3;
if (caretStartCol == caretEndCol)
{
endPos.X += 10;
}
DrawDashedLine(startPos, endPos, color, thickness); DrawDashedLine(startPos, endPos, color, thickness);
//DrawLine(startPos, endPos, color, thickness); //DrawLine(startPos, endPos, color, thickness);
} }
public override void _Draw() public override void _Draw()
{ {
UnderlineRange(_currentLine, _selectionStartCol, _selectionEndCol, new Color(1, 0, 0)); //UnderlineRange(_currentLine, _selectionStartCol, _selectionEndCol, new Color(1, 0, 0));
foreach (var (fileSpan, diagnostic) in _diagnostics) foreach (var (fileSpan, diagnostic) in _diagnostics)
{ {
if (diagnostic.Location.IsInSource) if (diagnostic.Location.IsInSource)