@@ -501,6 +501,11 @@ impl FilePicker {
501501return false ;
502502}
503503
504+ // Skip files if we're in directory-only mode
505+ if !files_only && !node. is_directory {
506+ return false ;
507+ }
508+
504509// Compact indentation with maximum depth limit to prevent exponential growth
505510let indent_per_level =8.0 ; // Reduced from 12.0
506511let max_indent =80.0 ; // Maximum indentation to prevent excessive nesting
@@ -589,14 +594,31 @@ impl FilePicker {
589594 icon_color
590595) ;
591596
592- // Draw folder name
597+ // Draw folder name with selection indicator
593598let name_pos = egui:: Pos2 :: new ( icon_pos. x +16.0 , text_y) ;
599+ let folder_name =if files_only{
600+ format ! ( "{}/" , node. name)
601+ } else {
602+ // In directory selection mode, add visual indicator that it's selectable
603+ if is_selected{
604+ format ! ( "✓ {}/" , node. name)
605+ } else {
606+ format ! ( "{}/" , node. name)
607+ }
608+ } ;
609+
610+ let name_color =if is_selected{
611+ MutantColors :: ACCENT_ORANGE
612+ } else {
613+ icon_color
614+ } ;
615+
594616 ui. painter ( ) . text (
595617 name_pos,
596618 egui:: Align2 :: LEFT_CENTER ,
597- format ! ( "{}/" , node . name ) ,
619+ folder_name ,
598620 icon_font_id,
599- icon_color
621+ name_color
600622) ;
601623
602624// Handle directory interaction
@@ -605,13 +627,18 @@ impl FilePicker {
605627// In files_only mode, just expand/collapse directories
606628 node. expanded = !node. expanded ;
607629} else {
608- // In directory selection mode,allow selecting directories
630+ // In directory selection mode,single click selects, double click expands
609631* selected_file_arc. write ( ) . unwrap ( ) =Some ( node. path . clone ( ) ) ;
610632* error_message. write ( ) . unwrap ( ) =None ;
611633 file_selected =true ;
612634}
613635}
614636
637+ // Handle double-click to expand/collapse in directory selection mode
638+ if !files_only && button_response. double_clicked ( ) {
639+ node. expanded = !node. expanded ;
640+ }
641+
615642if button_response. hovered ( ) {
616643 ui. ctx ( ) . set_cursor_icon ( egui:: CursorIcon :: PointingHand ) ;
617644}
@@ -737,6 +764,11 @@ impl FilePicker {
737764} ) ;
738765
739766for ( _, child) in sorted_children{
767+ // Skip files if we're in directory-only mode
768+ if !files_only && !child. is_directory {
769+ continue ;
770+ }
771+
740772if Self :: draw_tree_node_static (
741773 ui,
742774 child,