Fix arrow key scroll focus

This commit is contained in:
Matt Parker
2025-10-13 21:04:29 +10:00
parent 8f64f2266e
commit d8de8c25aa
4 changed files with 10 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ public partial class SearchAllFilesWindow : PopupPanel
public override void _Ready()
{
_resultCountLabel = GetNode<Label>("%ResultCountLabel");
_resultCountLabel.Text = "";
_lineEdit = GetNode<LineEdit>("%SearchLineEdit");
_lineEdit.Text = "";
_searchResultsContainer = GetNode<VBoxContainer>("%SearchResultsVBoxContainer");

View File

@@ -60,6 +60,7 @@ text = "Test"
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
follow_focus = true
[node name="SearchResultsVBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer"]
unique_name_in_owner = true

View File

@@ -6,6 +6,7 @@ namespace SharpIDE.Godot.Features.Search;
public partial class SearchWindow : PopupPanel
{
private Label _resultCountLabel = null!;
private LineEdit _lineEdit = null!;
private VBoxContainer _searchResultsContainer = null!;
public SharpIdeSolutionModel Solution { get; set; } = null!;
@@ -15,6 +16,8 @@ public partial class SearchWindow : PopupPanel
public override void _Ready()
{
_resultCountLabel = GetNode<Label>("%ResultCountLabel");
_resultCountLabel.Text = "";
_lineEdit = GetNode<LineEdit>("%SearchLineEdit");
_lineEdit.Text = "";
_searchResultsContainer = GetNode<VBoxContainer>("%SearchResultsVBoxContainer");
@@ -41,6 +44,7 @@ public partial class SearchWindow : PopupPanel
private async Task Search(string text, CancellationToken cancellationToken)
{
var result = await SearchService.FindInFiles(Solution, text, cancellationToken);
if (cancellationToken.IsCancellationRequested) return;
await this.InvokeAsync(() =>
{
_searchResultsContainer.GetChildren().ToList().ForEach(s => s.QueueFree());
@@ -51,6 +55,7 @@ public partial class SearchWindow : PopupPanel
resultNode.ParentSearchWindow = this;
_searchResultsContainer.AddChild(resultNode);
}
_resultCountLabel.Text = $"{result.Count} files(s) found";
});
}
}

View File

@@ -46,7 +46,8 @@ layout_mode = 2
layout_mode = 2
text = "Find Text in Files"
[node name="Label2" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"]
[node name="ResultCountLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 14
text = " 30 matches in 5 files"
@@ -59,6 +60,7 @@ text = "Test"
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
follow_focus = true
[node name="SearchResultsVBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/ScrollContainer"]
unique_name_in_owner = true