KirillOsenkov / MSBuildStructuredLog

A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.
MIT License
1.44k stars 192 forks source link

Search box should retain text between tabs #240

Open Scottj1s opened 5 years ago

Scottj1s commented 5 years ago

I often find myself searching for the same text in all three tabs. But switching between them clears the search box. Preserving the text would nice (and a unified search across all 3 would be nicer). Thanks for this tool - indispensable!

KirillOsenkov commented 5 years ago

Yes, I've tripped over this myself quite a few times.

MarcoRossignoli commented 5 years ago

I don't know if it's related to this, but could be also great keep search text in case of refresh(F5), often when I do analysis I override binlog and press F5 with some filter i.e. '[coverlet]'. I fixed this in my local repo, I don't know if could be useful to someone else. Something like(but maybe could be structured to solve also other similar issue)

 private BuildControl _oldBuildControl;

 private BuildControl CurrentBuildControl => mainContent.Content as BuildControl;

        private BuildControl _oldBuildControl;

        private void SetContent(object content)
        {
            if (mainContent.Content is BuildControl)
            {
                _oldBuildControl = (BuildControl)mainContent.Content;
            }

            mainContent.Content = content;

            if (content == null)
            {
                logFilePath = null;
                projectFilePath = null;
                currentBuild = null;
            }

            if (content is BuildControl)
            {
                ReloadMenu.Visibility = logFilePath != null ? Visibility.Visible : Visibility.Collapsed;
                SaveAsMenu.Visibility = Visibility.Visible;
            }
            else
            {
                ReloadMenu.Visibility = Visibility.Collapsed;
                SaveAsMenu.Visibility = Visibility.Collapsed;
            }

            if (mainContent.Content != null && _oldBuildControl != null && mainContent.Content is BuildControl currentContent && currentContent != _oldBuildControl && !string.IsNullOrEmpty(_oldBuildControl.searchLogControl.SearchText))
            {
                currentContent.searchLogControl.searchTextBox.SelectedText = _oldBuildControl.searchLogControl.SearchText;
            }
        }
KirillOsenkov commented 5 years ago

@MarcoRossignoli this looks good to me, wanna send a PR?

MarcoRossignoli commented 5 years ago

Will do