feat: add dummy search bar in diff view
This commit is contained in:
@@ -60,22 +60,28 @@ impl PullRequestChangeView {
|
||||
.detach();
|
||||
}
|
||||
|
||||
fn handle_file_tree_item_click(&mut self, i: usize, cx: &mut gpui::Context<Self>) {
|
||||
fn handle_file_tree_item_click(
|
||||
&mut self,
|
||||
i: usize,
|
||||
window: &mut gpui::Window,
|
||||
cx: &mut gpui::Context<Self>,
|
||||
) {
|
||||
let item = &self.file_tree_items[i];
|
||||
match item.kind {
|
||||
| FileTreeItemKind::Directory => {
|
||||
self.file_tree_state
|
||||
.toggle_directory(&item.full_path, &self.file_tree_items);
|
||||
cx.notify();
|
||||
}
|
||||
| FileTreeItemKind::File => {
|
||||
self.selected_file_path = Some(Arc::clone(&item.full_path));
|
||||
self.file_tree_state.highlight_item(i);
|
||||
self.diff_view.update(cx, |diff_view, cx| {
|
||||
diff_view.show_diff_for_file(&item.full_path, cx);
|
||||
});
|
||||
cx.notify();
|
||||
}
|
||||
| FileTreeItemKind::Directory => {
|
||||
self.file_tree_state
|
||||
.toggle_directory(&item.full_path, &self.file_tree_items);
|
||||
cx.notify();
|
||||
}
|
||||
| FileTreeItemKind::File => {
|
||||
self.selected_file_path = Some(Arc::clone(&item.full_path));
|
||||
self.file_tree_state.highlight_item(i);
|
||||
self.diff_view.update(cx, |diff_view, cx| {
|
||||
diff_view.show_diff_for_file(&item.full_path, cx);
|
||||
});
|
||||
cx.focus_view(&self.diff_view, window);
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,9 +112,11 @@ impl gpui::Render for PullRequestChangeView {
|
||||
file_tree(self.file_tree_state.clone(), move |i, _, cx| {
|
||||
weak.read(cx).file_tree_items[i].clone()
|
||||
})
|
||||
.on_item_click(cx.listener(|this, i, _, cx| {
|
||||
this.handle_file_tree_item_click(*i, cx);
|
||||
})),
|
||||
.on_item_click(cx.listener(
|
||||
|this, i, window, cx| {
|
||||
this.handle_file_tree_item_click(*i, window, cx);
|
||||
},
|
||||
)),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
|
||||
Reference in New Issue
Block a user