@@ -51,6 +51,7 @@ use panel::{
5151use project:: {
5252 Fs , Project , ProjectPath ,
5353 git_store:: { GitStoreEvent , Repository , RepositoryEvent , RepositoryId , pending_op} ,
54+ project_settings:: { GitPathStyle , ProjectSettings } ,
5455} ;
5556use serde:: { Deserialize , Serialize } ;
5657use settings:: { Settings , SettingsStore , StatusStyle } ;
@@ -3954,6 +3955,7 @@ impl GitPanel {
39543955 cx : & Context < Self > ,
39553956 ) -> AnyElement {
39563957 let path_style = self . project . read ( cx) . path_style ( cx) ;
3958+ let git_path_style = ProjectSettings :: get_global ( cx) . git . path_style ;
39573959 let display_name = entry. display_name ( path_style) ;
39583960
39593961 let selected = self . selected_entry == Some ( ix) ;
@@ -4053,7 +4055,6 @@ impl GitPanel {
40534055 } else {
40544056 cx. theme ( ) . colors ( ) . ghost_element_active
40554057 } ;
4056-
40574058 h_flex ( )
40584059 . id ( id)
40594060 . h ( self . list_item_height ( ) )
@@ -4151,28 +4152,70 @@ impl GitPanel {
41514152 h_flex ( )
41524153 . items_center ( )
41534154 . flex_1 ( )
4154- // .overflow_hidden()
4155- . when_some ( entry. parent_dir ( path_style) , |this, parent| {
4156- if !parent. is_empty ( ) {
4157- this. child (
4158- self . entry_label (
4159- format ! ( "{parent}{}" , path_style. separator( ) ) ,
4160- path_color,
4161- )
4162- . when ( status. is_deleted ( ) , |this| this. strikethrough ( ) ) ,
4163- )
4164- } else {
4165- this
4166- }
4167- } )
4168- . child (
4169- self . entry_label ( display_name, label_color)
4170- . when ( status. is_deleted ( ) , |this| this. strikethrough ( ) ) ,
4171- ) ,
4155+ . child ( h_flex ( ) . items_center ( ) . flex_1 ( ) . map ( |this| {
4156+ self . path_formatted (
4157+ this,
4158+ entry. parent_dir ( path_style) ,
4159+ path_color,
4160+ display_name,
4161+ label_color,
4162+ path_style,
4163+ git_path_style,
4164+ status. is_deleted ( ) ,
4165+ )
4166+ } ) ) ,
41724167 )
41734168 . into_any_element ( )
41744169 }
41754170
4171+ fn path_formatted (
4172+ & self ,
4173+ parent : Div ,
4174+ directory : Option < String > ,
4175+ path_color : Color ,
4176+ file_name : String ,
4177+ label_color : Color ,
4178+ path_style : PathStyle ,
4179+ git_path_style : GitPathStyle ,
4180+ strikethrough : bool ,
4181+ ) -> Div {
4182+ parent
4183+ . when ( git_path_style == GitPathStyle :: FileNameFirst , |this| {
4184+ this. child (
4185+ self . entry_label (
4186+ match directory. as_ref ( ) . is_none_or ( |d| d. is_empty ( ) ) {
4187+ true => file_name. clone ( ) ,
4188+ false => format ! ( "{file_name} " ) ,
4189+ } ,
4190+ label_color,
4191+ )
4192+ . when ( strikethrough, Label :: strikethrough) ,
4193+ )
4194+ } )
4195+ . when_some ( directory, |this, dir| {
4196+ match (
4197+ !dir. is_empty ( ) ,
4198+ git_path_style == GitPathStyle :: FileNameFirst ,
4199+ ) {
4200+ ( true , true ) => this. child (
4201+ self . entry_label ( dir, path_color)
4202+ . when ( strikethrough, Label :: strikethrough) ,
4203+ ) ,
4204+ ( true , false ) => this. child (
4205+ self . entry_label ( format ! ( "{dir}{}" , path_style. separator( ) ) , path_color)
4206+ . when ( strikethrough, Label :: strikethrough) ,
4207+ ) ,
4208+ _ => this,
4209+ }
4210+ } )
4211+ . when ( git_path_style == GitPathStyle :: FilePathFirst , |this| {
4212+ this. child (
4213+ self . entry_label ( file_name, label_color)
4214+ . when ( strikethrough, Label :: strikethrough) ,
4215+ )
4216+ } )
4217+ }
4218+
41764219 fn has_write_access ( & self , cx : & App ) -> bool {
41774220 !self . project . read ( cx) . is_read_only ( cx)
41784221 }
0 commit comments