find in files ergonomics

This commit is contained in:
Matt Parker
2025-09-25 00:01:22 +10:00
parent 21dd4aa199
commit 5c24d53201
2 changed files with 22 additions and 3 deletions

View File

@@ -16,8 +16,17 @@ public partial class SearchWindow : PopupPanel
public override void _Ready()
{
_lineEdit = GetNode<LineEdit>("%SearchLineEdit");
_lineEdit.Text = "";
_searchResultsContainer = GetNode<VBoxContainer>("%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)

View File

@@ -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"]