@@ -82,7 +82,7 @@ public AvaloniaList<string> Children
82
82
{
83
83
get ;
84
84
private set ;
85
- } = new AvaloniaList < string > ( ) ;
85
+ } = [ ] ;
86
86
87
87
public string SearchChangeFilter
88
88
{
@@ -106,13 +106,68 @@ public AvaloniaList<Models.CommitLink> WebLinks
106
106
{
107
107
get ;
108
108
private set ;
109
- } = new AvaloniaList < Models . CommitLink > ( ) ;
109
+ } = [ ] ;
110
110
111
111
public AvaloniaList < Models . IssueTrackerRule > IssueTrackerRules
112
112
{
113
113
get => _repo . Settings ? . IssueTrackerRules ;
114
114
}
115
115
116
+ public string RevisionFileSearchFilter
117
+ {
118
+ get => _revisionFileSearchFilter ;
119
+ set
120
+ {
121
+ if ( SetProperty ( ref _revisionFileSearchFilter , value ) )
122
+ {
123
+ RevisionFileSearchSuggestion . Clear ( ) ;
124
+
125
+ if ( ! string . IsNullOrEmpty ( value ) )
126
+ {
127
+ if ( _revisionFiles . Count == 0 )
128
+ {
129
+ var sha = Commit . SHA ;
130
+
131
+ Task . Run ( ( ) =>
132
+ {
133
+ var files = new Commands . QueryRevisionFileNames ( _repo . FullPath , sha ) . Result ( ) ;
134
+
135
+ Dispatcher . UIThread . Invoke ( ( ) => {
136
+ if ( sha == Commit . SHA )
137
+ {
138
+ _revisionFiles . Clear ( ) ;
139
+ _revisionFiles . AddRange ( files ) ;
140
+ UpdateRevisionFileSearchSuggestion ( ) ;
141
+ }
142
+ } ) ;
143
+ } ) ;
144
+ }
145
+ else
146
+ {
147
+ UpdateRevisionFileSearchSuggestion ( ) ;
148
+ }
149
+ }
150
+ else
151
+ {
152
+ IsRevisionFileSearchSuggestionOpen = false ;
153
+ GC . Collect ( ) ;
154
+ }
155
+ }
156
+ }
157
+ }
158
+
159
+ public AvaloniaList < string > RevisionFileSearchSuggestion
160
+ {
161
+ get ;
162
+ private set ;
163
+ } = [ ] ;
164
+
165
+ public bool IsRevisionFileSearchSuggestionOpen
166
+ {
167
+ get => _isRevisionFileSearchSuggestionOpen ;
168
+ set => SetProperty ( ref _isRevisionFileSearchSuggestionOpen , value ) ;
169
+ }
170
+
116
171
public CommitDetail ( Repository repo )
117
172
{
118
173
_repo = repo ;
@@ -147,17 +202,23 @@ public void Cleanup()
147
202
{
148
203
_repo = null ;
149
204
_commit = null ;
205
+
150
206
if ( _changes != null )
151
207
_changes . Clear ( ) ;
152
208
if ( _visibleChanges != null )
153
209
_visibleChanges . Clear ( ) ;
154
210
if ( _selectedChanges != null )
155
211
_selectedChanges . Clear ( ) ;
212
+
156
213
_signInfo = null ;
157
214
_searchChangeFilter = null ;
158
215
_diffContext = null ;
159
216
_viewRevisionFileContent = null ;
160
217
_cancelToken = null ;
218
+
219
+ WebLinks . Clear ( ) ;
220
+ _revisionFiles . Clear ( ) ;
221
+ RevisionFileSearchSuggestion . Clear ( ) ;
161
222
}
162
223
163
224
public void NavigateTo ( string commitSHA )
@@ -175,6 +236,11 @@ public void ClearSearchChangeFilter()
175
236
SearchChangeFilter = string . Empty ;
176
237
}
177
238
239
+ public void ClearRevisionFileSearchFilter ( )
240
+ {
241
+ RevisionFileSearchFilter = string . Empty ;
242
+ }
243
+
178
244
public Models . Commit GetParent ( string sha )
179
245
{
180
246
return new Commands . QuerySingleCommit ( _repo . FullPath , sha ) . Result ( ) ;
@@ -543,13 +609,17 @@ public ContextMenu CreateRevisionFileContextMenu(Models.Object file)
543
609
private void Refresh ( )
544
610
{
545
611
_changes = null ;
612
+ _revisionFiles . Clear ( ) ;
613
+
546
614
FullMessage = string . Empty ;
547
615
SignInfo = null ;
548
616
Changes = [ ] ;
549
617
VisibleChanges = null ;
550
618
SelectedChanges = null ;
551
619
ViewRevisionFileContent = null ;
552
620
Children . Clear ( ) ;
621
+ RevisionFileSearchFilter = string . Empty ;
622
+ IsRevisionFileSearchSuggestionOpen = false ;
553
623
554
624
if ( _commit == null )
555
625
return ;
@@ -716,6 +786,24 @@ private void TryToAddContextMenuItemsForGitLFS(ContextMenu menu, string path)
716
786
menu . Items . Add ( new MenuItem ( ) { Header = "-" } ) ;
717
787
}
718
788
789
+ private void UpdateRevisionFileSearchSuggestion ( )
790
+ {
791
+ var suggestion = new List < string > ( ) ;
792
+ foreach ( var file in _revisionFiles )
793
+ {
794
+ if ( file . Contains ( _revisionFileSearchFilter , StringComparison . OrdinalIgnoreCase ) &&
795
+ file . Length != _revisionFileSearchFilter . Length )
796
+ suggestion . Add ( file ) ;
797
+
798
+ if ( suggestion . Count >= 100 )
799
+ break ;
800
+ }
801
+
802
+ RevisionFileSearchSuggestion . Clear ( ) ;
803
+ RevisionFileSearchSuggestion . AddRange ( suggestion ) ;
804
+ IsRevisionFileSearchSuggestionOpen = suggestion . Count > 0 ;
805
+ }
806
+
719
807
[ GeneratedRegex ( @"^version https://git-lfs.github.com/spec/v\d+\r?\noid sha256:([0-9a-f]+)\r?\nsize (\d+)[\r\n]*$" ) ]
720
808
private static partial Regex REG_LFS_FORMAT ( ) ;
721
809
@@ -736,5 +824,8 @@ private void TryToAddContextMenuItemsForGitLFS(ContextMenu menu, string path)
736
824
private DiffContext _diffContext = null ;
737
825
private object _viewRevisionFileContent = null ;
738
826
private Commands . Command . CancelToken _cancelToken = null ;
827
+ private List < string > _revisionFiles = [ ] ;
828
+ private string _revisionFileSearchFilter = string . Empty ;
829
+ private bool _isRevisionFileSearchSuggestionOpen = false ;
739
830
}
740
831
}
0 commit comments