@@ -74,6 +74,7 @@ use std::{
74
74
fmt:: { self , Write } ,
75
75
iter, mem,
76
76
ops:: { Deref , Range } ,
77
+ path:: Path ,
77
78
rc:: Rc ,
78
79
sync:: Arc ,
79
80
time:: { Duration , Instant } ,
@@ -3693,7 +3694,12 @@ impl EditorElement {
3693
3694
} )
3694
3695
. take ( 1 ) ,
3695
3696
)
3696
- . children ( indicator)
3697
+ . child (
3698
+ h_flex ( )
3699
+ . size ( Pixels ( 12.0 ) )
3700
+ . justify_center ( )
3701
+ . children ( indicator) ,
3702
+ )
3697
3703
. child (
3698
3704
h_flex ( )
3699
3705
. cursor_pointer ( )
@@ -3782,25 +3788,31 @@ impl EditorElement {
3782
3788
&& let Some ( worktree) =
3783
3789
project. read ( cx) . worktree_for_id ( file. worktree_id ( cx) , cx)
3784
3790
{
3791
+ let worktree = worktree. read ( cx) ;
3785
3792
let relative_path = file. path ( ) ;
3786
- let entry_for_path = worktree. read ( cx) . entry_for_path ( relative_path) ;
3787
- let abs_path = entry_for_path. and_then ( |e| e. canonical_path . as_deref ( ) ) ;
3788
- let has_relative_path =
3789
- worktree. read ( cx) . root_entry ( ) . is_some_and ( Entry :: is_dir) ;
3793
+ let entry_for_path = worktree. entry_for_path ( relative_path) ;
3794
+ let abs_path = entry_for_path. map ( |e| {
3795
+ e. canonical_path . as_deref ( ) . map_or_else (
3796
+ || worktree. abs_path ( ) . join ( relative_path) ,
3797
+ Path :: to_path_buf,
3798
+ )
3799
+ } ) ;
3800
+ let has_relative_path = worktree. root_entry ( ) . is_some_and ( Entry :: is_dir) ;
3790
3801
3791
- let parent_abs_path =
3792
- abs_path. and_then ( |abs_path| Some ( abs_path. parent ( ) ?. to_path_buf ( ) ) ) ;
3802
+ let parent_abs_path = abs_path
3803
+ . as_ref ( )
3804
+ . and_then ( |abs_path| Some ( abs_path. parent ( ) ?. to_path_buf ( ) ) ) ;
3793
3805
let relative_path = has_relative_path
3794
3806
. then_some ( relative_path)
3795
3807
. map ( ToOwned :: to_owned) ;
3796
3808
3797
3809
let visible_in_project_panel =
3798
- relative_path. is_some ( ) && worktree. read ( cx ) . is_visible ( ) ;
3810
+ relative_path. is_some ( ) && worktree. is_visible ( ) ;
3799
3811
let reveal_in_project_panel = entry_for_path
3800
3812
. filter ( |_| visible_in_project_panel)
3801
3813
. map ( |entry| entry. id ) ;
3802
3814
menu = menu
3803
- . when_some ( abs_path. map ( ToOwned :: to_owned ) , |menu, abs_path| {
3815
+ . when_some ( abs_path, |menu, abs_path| {
3804
3816
menu. entry (
3805
3817
"Copy Path" ,
3806
3818
Some ( Box :: new ( zed_actions:: workspace:: CopyPath ) ) ,
0 commit comments