Identify Worktree entries by their inode

This will allow us to re-parent elements when re-scanning when the file system changes.
This commit is contained in:
Nathan Sobo
2021-04-13 20:09:41 -06:00
committed by Nathan Sobo
parent 3c0bbe5eb5
commit 24cdfd2471
8 changed files with 95 additions and 89 deletions
+6 -9
View File
@@ -105,15 +105,12 @@ impl Pane {
self.items.get(self.active_item).cloned()
}
pub fn activate_entry(
&mut self,
entry_id: (usize, usize),
ctx: &mut ViewContext<Self>,
) -> bool {
if let Some(index) = self.items.iter().position(|item| {
item.entry_id(ctx.as_ref())
.map_or(false, |id| id == entry_id)
}) {
pub fn activate_entry(&mut self, entry_id: (usize, u64), ctx: &mut ViewContext<Self>) -> bool {
if let Some(index) = self
.items
.iter()
.position(|item| item.entry_id(ctx.as_ref()).map_or(false, |id| id == entry_id))
{
self.activate_item(index, ctx);
true
} else {