@@ -7,10 +7,9 @@ module file_tree_renderer_module |
| 7 | 7 | |
| 8 | 8 | public :: render_file_tree |
| 9 | 9 | |
| 10 | | - ! UTF-8 box-drawing characters |
| 11 | | - character(len=*), parameter :: BRANCH_LAST = '└──' |
| 12 | | - character(len=*), parameter :: BRANCH_MID = '├──' |
| 13 | | - character(len=*), parameter :: VERTICAL = '│' |
| 10 | + ! Simple expansion indicators (no box-drawing) |
| 11 | + character(len=*), parameter :: EXPANDED_DIR = '-' |
| 12 | + character(len=*), parameter :: COLLAPSED_DIR = '+' |
| 14 | 13 | character(len=1), parameter :: ESC = achar(27) |
| 15 | 14 | |
| 16 | 15 | contains |
@@ -87,7 +86,7 @@ contains |
| 87 | 86 | ! Fourth row: exit |
| 88 | 87 | call terminal_move_cursor(end_row, start_col) |
| 89 | 88 | call terminal_write(ESC // '[90m') ! Gray |
| 90 | | - call terminal_write('ctrl-/:collapse esc/ctrl-b:close') |
| 89 | + call terminal_write('ctrl-/:collapse esc/F3:close') |
| 91 | 90 | call terminal_write(ESC // '[0m') |
| 92 | 91 | end if |
| 93 | 92 | else |
@@ -95,7 +94,7 @@ contains |
| 95 | 94 | if (end_row >= start_row + 1) then |
| 96 | 95 | call terminal_move_cursor(end_row, start_col) |
| 97 | 96 | call terminal_write(ESC // '[90m') ! Gray |
| 98 | | - call terminal_write('.:hide ctrl-/:hints esc/ctrl-b:close') |
| 97 | + call terminal_write('.:hide ctrl-/:hints esc/F3:close') |
| 99 | 98 | call terminal_write(ESC // '[0m') |
| 100 | 99 | end if |
| 101 | 100 | end if |
@@ -110,7 +109,7 @@ contains |
| 110 | 109 | integer, intent(inout) :: item_idx, current_row |
| 111 | 110 | integer, intent(in) :: end_row, start_col, width |
| 112 | 111 | |
| 113 | | - character(len=:), allocatable :: line, new_prefix, branch |
| 112 | + character(len=:), allocatable :: line, new_prefix |
| 114 | 113 | type(tree_node_t), pointer :: child |
| 115 | 114 | logical :: is_selected, is_last_child |
| 116 | 115 | |
@@ -127,24 +126,23 @@ contains |
| 127 | 126 | |
| 128 | 127 | ! Only render if within viewport and current_row fits |
| 129 | 128 | if (item_idx >= state%viewport_offset .and. current_row <= end_row) then |
| 130 | | - ! Build line with tree structure |
| 131 | | - if (is_last) then |
| 132 | | - branch = BRANCH_LAST |
| 133 | | - else |
| 134 | | - branch = BRANCH_MID |
| 135 | | - end if |
| 136 | | - |
| 137 | | - ! Construct the line - prefix can be empty string, that's fine |
| 138 | | - if (.not. node%is_file .and. associated(node%first_child)) then |
| 139 | | - ! Directory with children - add expand/collapse indicator |
| 140 | | - if (node%expanded) then |
| 141 | | - line = prefix // branch // ' ▾ ' // trim(node%name) |
| 129 | + ! Build line with simple +/- indicators and indentation |
| 130 | + if (.not. node%is_file) then |
| 131 | + ! Directory - add expand/collapse indicator and / suffix |
| 132 | + if (associated(node%first_child)) then |
| 133 | + ! Directory with children |
| 134 | + if (node%expanded) then |
| 135 | + line = prefix // EXPANDED_DIR // ' ' // trim(node%name) // '/' |
| 136 | + else |
| 137 | + line = prefix // COLLAPSED_DIR // ' ' // trim(node%name) // '/' |
| 138 | + end if |
| 142 | 139 | else |
| 143 | | - line = prefix // branch // ' ▸ ' // trim(node%name) |
| 140 | + ! Empty directory - no expand/collapse indicator |
| 141 | + line = prefix // ' ' // trim(node%name) // '/' |
| 144 | 142 | end if |
| 145 | 143 | else |
| 146 | | - ! File or empty directory - no indicator |
| 147 | | - line = prefix // branch // ' ' // trim(node%name) |
| 144 | + ! File - just indentation and name |
| 145 | + line = prefix // ' ' // trim(node%name) |
| 148 | 146 | end if |
| 149 | 147 | |
| 150 | 148 | ! Add status indicators for files only |
@@ -194,15 +192,8 @@ contains |
| 194 | 192 | ! Root's children start with no prefix |
| 195 | 193 | new_prefix = '' |
| 196 | 194 | else |
| 197 | | - ! Non-root children inherit prefix and add continuation |
| 198 | | - ! IMPORTANT: Don't trim prefix! It contains accumulated indentation |
| 199 | | - if (is_last) then |
| 200 | | - ! Current node is last, so children get spaces (no vertical line continues) |
| 201 | | - new_prefix = prefix // ' ' |
| 202 | | - else |
| 203 | | - ! Current node is not last, so vertical line continues for children |
| 204 | | - new_prefix = prefix // VERTICAL // ' ' |
| 205 | | - end if |
| 195 | + ! Non-root children inherit prefix and add 2-space indentation |
| 196 | + new_prefix = prefix // ' ' |
| 206 | 197 | end if |
| 207 | 198 | |
| 208 | 199 | call render_tree_node(child, new_prefix, is_last_child, .false., & |