Clear selected index when updating file finder's matches
This commit is contained in:
parent
1b12437f7e
commit
880d330459
1 changed files with 4 additions and 0 deletions
|
@ -115,11 +115,13 @@ impl FileFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventEmitter<DismissEvent> for FileFinder {}
|
impl EventEmitter<DismissEvent> for FileFinder {}
|
||||||
|
|
||||||
impl FocusableView for FileFinder {
|
impl FocusableView for FileFinder {
|
||||||
fn focus_handle(&self, cx: &AppContext) -> FocusHandle {
|
fn focus_handle(&self, cx: &AppContext) -> FocusHandle {
|
||||||
self.picker.focus_handle(cx)
|
self.picker.focus_handle(cx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for FileFinder {
|
impl Render for FileFinder {
|
||||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||||
v_flex().w(rems(34.)).child(self.picker.clone())
|
v_flex().w(rems(34.)).child(self.picker.clone())
|
||||||
|
@ -385,6 +387,7 @@ impl FileFinderDelegate {
|
||||||
let did_cancel = cancel_flag.load(atomic::Ordering::Relaxed);
|
let did_cancel = cancel_flag.load(atomic::Ordering::Relaxed);
|
||||||
picker
|
picker
|
||||||
.update(&mut cx, |picker, cx| {
|
.update(&mut cx, |picker, cx| {
|
||||||
|
picker.delegate.selected_index.take();
|
||||||
picker
|
picker
|
||||||
.delegate
|
.delegate
|
||||||
.set_search_matches(search_id, did_cancel, query, matches, cx)
|
.set_search_matches(search_id, did_cancel, query, matches, cx)
|
||||||
|
@ -623,6 +626,7 @@ impl PickerDelegate for FileFinderDelegate {
|
||||||
if raw_query.is_empty() {
|
if raw_query.is_empty() {
|
||||||
let project = self.project.read(cx);
|
let project = self.project.read(cx);
|
||||||
self.latest_search_id = post_inc(&mut self.search_count);
|
self.latest_search_id = post_inc(&mut self.search_count);
|
||||||
|
self.selected_index.take();
|
||||||
self.matches = Matches {
|
self.matches = Matches {
|
||||||
history: self
|
history: self
|
||||||
.history_items
|
.history_items
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue