Pane focus working. Modals seem broken now
This commit is contained in:
parent
049149320c
commit
6f180ed822
11 changed files with 43 additions and 103 deletions
|
@ -73,7 +73,6 @@ pub struct ProjectSearchView {
|
|||
regex: bool,
|
||||
query_contains_error: bool,
|
||||
active_match_index: Option<usize>,
|
||||
results_editor_was_focused: bool,
|
||||
}
|
||||
|
||||
pub struct ProjectSearchBar {
|
||||
|
@ -197,12 +196,6 @@ impl View for ProjectSearchView {
|
|||
.0
|
||||
.insert(self.model.read(cx).project.downgrade(), handle)
|
||||
});
|
||||
|
||||
if self.results_editor_was_focused && !self.model.read(cx).match_ranges.is_empty() {
|
||||
self.focus_results_editor(cx);
|
||||
} else {
|
||||
cx.focus(&self.query_editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,14 +323,6 @@ impl Item for ProjectSearchView {
|
|||
.update(cx, |editor, cx| editor.navigate(data, cx))
|
||||
}
|
||||
|
||||
fn should_activate_item_on_event(event: &Self::Event) -> bool {
|
||||
if let ViewEvent::EditorEvent(editor_event) = event {
|
||||
Editor::should_activate_item_on_event(editor_event)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn should_update_tab_on_event(event: &ViewEvent) -> bool {
|
||||
matches!(event, ViewEvent::UpdateTab)
|
||||
}
|
||||
|
@ -385,12 +370,6 @@ impl ProjectSearchView {
|
|||
cx.emit(ViewEvent::EditorEvent(event.clone()))
|
||||
})
|
||||
.detach();
|
||||
cx.observe_focus(&query_editor, |this, _, focused, _| {
|
||||
if focused {
|
||||
this.results_editor_was_focused = false;
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
||||
let results_editor = cx.add_view(|cx| {
|
||||
let mut editor = Editor::for_multibuffer(excerpts, Some(project), cx);
|
||||
|
@ -399,12 +378,7 @@ impl ProjectSearchView {
|
|||
});
|
||||
cx.observe(&results_editor, |_, _, cx| cx.emit(ViewEvent::UpdateTab))
|
||||
.detach();
|
||||
cx.observe_focus(&results_editor, |this, _, focused, _| {
|
||||
if focused {
|
||||
this.results_editor_was_focused = true;
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
||||
cx.subscribe(&results_editor, |this, _, event, cx| {
|
||||
if matches!(event, editor::Event::SelectionsChanged { .. }) {
|
||||
this.update_match_index(cx);
|
||||
|
@ -423,7 +397,6 @@ impl ProjectSearchView {
|
|||
regex,
|
||||
query_contains_error: false,
|
||||
active_match_index: None,
|
||||
results_editor_was_focused: false,
|
||||
};
|
||||
this.model_changed(false, cx);
|
||||
this
|
||||
|
@ -905,6 +878,8 @@ impl ToolbarItemView for ProjectSearchBar {
|
|||
self.subscription = None;
|
||||
self.active_project_search = None;
|
||||
if let Some(search) = active_pane_item.and_then(|i| i.downcast::<ProjectSearchView>()) {
|
||||
let query_editor = search.read(cx).query_editor.clone();
|
||||
cx.reparent(query_editor);
|
||||
self.subscription = Some(cx.observe(&search, |_, _, cx| cx.notify()));
|
||||
self.active_project_search = Some(search);
|
||||
ToolbarItemLocation::PrimaryLeft {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue