diff --git a/src/StructuredLogViewer.Avalonia/Controls/BuildControl.xaml.cs b/src/StructuredLogViewer.Avalonia/Controls/BuildControl.xaml.cs index 480b691bd..f4848429b 100644 --- a/src/StructuredLogViewer.Avalonia/Controls/BuildControl.xaml.cs +++ b/src/StructuredLogViewer.Avalonia/Controls/BuildControl.xaml.cs @@ -887,6 +887,8 @@ private void BuildControl_Loaded(object sender, RoutedEventArgs e) public string InitialSearchText { get; set; } + public string SearchText => searchLogControl?.SearchText; + public void SelectItem(BaseNode item) { var parentChain = item.GetParentChainExcludingThis(); diff --git a/src/StructuredLogViewer.Avalonia/MainWindow.xaml.cs b/src/StructuredLogViewer.Avalonia/MainWindow.xaml.cs index c88c329ae..f841a50ac 100644 --- a/src/StructuredLogViewer.Avalonia/MainWindow.xaml.cs +++ b/src/StructuredLogViewer.Avalonia/MainWindow.xaml.cs @@ -388,7 +388,7 @@ private void BuildProject(string filePath) SetContent(parametersScreen); } - private async void BuildCore(string projectFilePath, string customArguments) + private async void BuildCore(string projectFilePath, string customArguments, string searchText = null) { var progress = new BuildProgress() { IsIndeterminate = true }; progress.ProgressText = $"Building {projectFilePath}..."; @@ -398,6 +398,10 @@ private async void BuildCore(string projectFilePath, string customArguments) progress.ProgressText = "Analyzing build..."; await QueueAnalyzeBuild(result); DisplayBuild(result); + if (!string.IsNullOrWhiteSpace(searchText) && CurrentBuildControl != null) + { + CurrentBuildControl.InitialSearchText = searchText; + } } private async Task QueueAnalyzeBuild(Build build) @@ -466,8 +470,9 @@ private void RebuildProjectOrSolution() { if (!string.IsNullOrEmpty(projectFilePath)) { + var searchText = CurrentBuildControl?.SearchText; var args = SettingsService.GetCustomArguments(projectFilePath); - BuildCore(projectFilePath, args); + BuildCore(projectFilePath, args, searchText); } }