Skip to content

Commit de8e211

Browse files
committed
enhance: auto-select the file after picking one from suggestion dropdown
Signed-off-by: leo <longshuang@msn.cn>
1 parent 89ce9b1 commit de8e211

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/Views/RevisionFileTreeView.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
99
x:Class="SourceGit.Views.RevisionFileTreeView"
1010
x:Name="ThisControl">
11-
<v:RevisionFileRowsListBox ItemsSource="{Binding #ThisControl.Rows}"
11+
<v:RevisionFileRowsListBox x:Name="RowsList"
12+
ItemsSource="{Binding #ThisControl.Rows}"
1213
Background="Transparent"
1314
SelectionMode="Single"
1415
SelectionChanged="OnRowsSelectionChanged"

src/Views/RevisionFileTreeView.axaml.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,14 @@ public async Task SetSearchResultAsync(string file)
325325
}
326326

327327
Rows.AddRange(rows);
328+
329+
if (_searchResult.Count > 0)
330+
{
331+
var lastNode = Rows[^1];
332+
RowsList.SelectedItem = lastNode;
333+
RowsList.ScrollIntoView(lastNode);
334+
}
335+
328336
GC.Collect();
329337
}
330338

0 commit comments

Comments
 (0)