open file from search result
This commit is contained in:
@@ -8,17 +8,25 @@ public partial class SearchResultComponent : MarginContainer
|
||||
private Label _matchingLineLabel = null!;
|
||||
private Label _fileNameLabel = null!;
|
||||
private Label _lineNumberLabel = null!;
|
||||
private Button _button = null!;
|
||||
|
||||
public SearchResult Result { get; set; } = null!;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_button = GetNode<Button>("Button");
|
||||
_matchingLineLabel = GetNode<Label>("%MatchingLineLabel");
|
||||
_fileNameLabel = GetNode<Label>("%FileNameLabel");
|
||||
_lineNumberLabel = GetNode<Label>("%LineNumberLabel");
|
||||
SetValue(Result);
|
||||
_button.Pressed += OnButtonPressed;
|
||||
}
|
||||
|
||||
|
||||
private void OnButtonPressed()
|
||||
{
|
||||
GodotGlobalEvents.InvokeFileExternallySelected(Result.File);
|
||||
}
|
||||
|
||||
private void SetValue(SearchResult result)
|
||||
{
|
||||
if (result is null) return;
|
||||
|
||||
Reference in New Issue
Block a user