Properly compute depth and path for project panel entries (#19068)
Closes https://github.com/zed-industries/zed/issues/18939 This fixes incorrect width estimates and horizontal scrollbar glitches Release Notes: - Fixes horizontal scrollbar not scrolling enough for certain paths ([#18939](https://github.com/zed-industries/zed/issues/18939)) Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
This commit is contained in:
parent
0a7468c89f
commit
79ed217e42
1 changed files with 2 additions and 4 deletions
|
@ -1911,11 +1911,9 @@ impl ProjectPanel {
|
||||||
Some(Arc::<Path>::from(full_path.join(suffix)))
|
Some(Arc::<Path>::from(full_path.join(suffix)))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
.or_else(|| entry.path.file_name().map(Path::new).map(Arc::from))
|
||||||
.unwrap_or_else(|| entry.path.clone());
|
.unwrap_or_else(|| entry.path.clone());
|
||||||
let depth = path
|
let depth = path.components().count();
|
||||||
.strip_prefix(worktree_abs_path)
|
|
||||||
.map(|suffix| suffix.components().count())
|
|
||||||
.unwrap_or_default();
|
|
||||||
(depth, path)
|
(depth, path)
|
||||||
};
|
};
|
||||||
let width_estimate = item_width_estimate(
|
let width_estimate = item_width_estimate(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue