diff --git a/src/SharpIDE.Godot/Features/Search/SearchWindow.cs b/src/SharpIDE.Godot/Features/Search/SearchWindow.cs index c6cc176..8ace754 100644 --- a/src/SharpIDE.Godot/Features/Search/SearchWindow.cs +++ b/src/SharpIDE.Godot/Features/Search/SearchWindow.cs @@ -16,8 +16,17 @@ public partial class SearchWindow : PopupPanel public override void _Ready() { _lineEdit = GetNode("%SearchLineEdit"); + _lineEdit.Text = ""; _searchResultsContainer = GetNode("%SearchResultsVBoxContainer"); + _searchResultsContainer.GetChildren().ToList().ForEach(s => s.QueueFree()); _lineEdit.TextChanged += OnTextChanged; + AboutToPopup += OnAboutToPopup; + } + + private void OnAboutToPopup() + { + _lineEdit.SelectAll(); + Callable.From(_lineEdit.GrabFocus).CallDeferred(); } private async void OnTextChanged(string newText) diff --git a/src/SharpIDE.Godot/Features/Search/SearchWindow.tscn b/src/SharpIDE.Godot/Features/Search/SearchWindow.tscn index 9225d39..e7d072f 100644 --- a/src/SharpIDE.Godot/Features/Search/SearchWindow.tscn +++ b/src/SharpIDE.Godot/Features/Search/SearchWindow.tscn @@ -1,13 +1,23 @@ -[gd_scene load_steps=3 format=3 uid="uid://8lk0qj233a7p"] +[gd_scene load_steps=4 format=3 uid="uid://8lk0qj233a7p"] [ext_resource type="Script" uid="uid://bah6tmifl41ce" path="res://Features/Search/SearchWindow.cs" id="1_ft33p"] [ext_resource type="PackedScene" uid="uid://d358tex0duum8" path="res://Features/Search/SearchResultComponent.tscn" id="2_cuaw5"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cuaw5"] +bg_color = Color(0.1764706, 0.1764706, 0.1764706, 1) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 +shadow_color = Color(0, 0, 0, 0.11764706) +shadow_size = 4 + [node name="SearchWindow" type="PopupPanel"] oversampling_override = 1.0 initial_position = 5 size = Vector2i(1200, 800) visible = true +theme_override_styles/panel = SubResource("StyleBoxFlat_cuaw5") script = ExtResource("1_ft33p") [node name="MarginContainer" type="MarginContainer" parent="."] @@ -20,9 +30,9 @@ offset_right = -4.0 offset_bottom = -4.0 grow_horizontal = 2 grow_vertical = 2 -theme_override_constants/margin_left = 5 +theme_override_constants/margin_left = 15 theme_override_constants/margin_top = 5 -theme_override_constants/margin_right = 5 +theme_override_constants/margin_right = 15 theme_override_constants/margin_bottom = 5 [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]