Skip to content

Commit c9362ef

Browse files
committed
selected completion rounded corners
1 parent ed35f02 commit c9362ef

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/SharpIDE.Godot/Features/CodeEditor/SharpIdeCodeEdit_Completions_Draw.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ public partial class SharpIdeCodeEdit
1919
private bool _isCodeCompletionScrollHovered = false;
2020
private bool _isCodeCompletionScrollPressed = false;
2121
private const int MaxLines = 7;
22+
23+
private static readonly StyleBoxFlat SelectedCompletionStyle = new StyleBoxFlat
24+
{
25+
CornerRadiusTopLeft = 4,
26+
CornerRadiusTopRight = 4,
27+
CornerRadiusBottomLeft = 4,
28+
CornerRadiusBottomRight = 4
29+
};
2230

2331
private int? GetCompletionOptionAtPoint(Vector2I point)
2432
{
@@ -201,16 +209,16 @@ private void DrawCompletionsPopup()
201209
);
202210

203211
var codeCompletionSelectedColor = GetThemeColor(ThemeStringNames.CompletionSelectedColor);
204-
RenderingServer.Singleton.CanvasItemAddRect(
212+
SelectedCompletionStyle.BgColor = codeCompletionSelectedColor;
213+
SelectedCompletionStyle.Draw(
205214
ci,
206215
new Rect2(
207216
new Vector2(
208217
_codeCompletionRect.Position.X,
209218
_codeCompletionRect.Position.Y + (_codeCompletionCurrentSelected - _codeCompletionLineOfs) * rowHeight
210219
),
211220
new Vector2(_codeCompletionRect.Size.X, rowHeight)
212-
),
213-
codeCompletionSelectedColor
221+
)
214222
);
215223

216224
// TODO: Cache

0 commit comments

Comments
 (0)