@@ -184,14 +184,15 @@ contains |
| 184 | 184 | ! Initialize tree pointer |
| 185 | 185 | tree_root => null() |
| 186 | 186 | |
| 187 | | - ! Detect terminal type for padding (fixes WezTerm/Ghostty top line cutoff) |
| 187 | + ! Detect terminal type for padding (fixes WezTerm/Ghostty/iTerm top line cutoff) |
| 188 | + ! Alternate screen buffer needs more padding to prevent top cutoff |
| 188 | 189 | call get_environment_variable("TERM_PROGRAM", term_program) |
| 189 | 190 | if (index(term_program, "WezTerm") > 0 .or. index(term_program, "ghostty") > 0) then |
| 190 | | - top_padding = 2 ! WezTerm/Ghostty need 2 lines of padding |
| 191 | + top_padding = 3 ! WezTerm/Ghostty need 3 lines in alternate screen |
| 191 | 192 | else if (index(term_program, "Apple_Terminal") > 0 .or. index(term_program, "iTerm") > 0) then |
| 192 | | - top_padding = 2 ! Terminal.app and iTerm2 also need 2 lines |
| 193 | + top_padding = 3 ! Terminal.app and iTerm2 also need 3 lines |
| 193 | 194 | else |
| 194 | | - top_padding = 1 ! Other terminals need 1 line |
| 195 | + top_padding = 2 ! Other terminals need 2 lines |
| 195 | 196 | end if |
| 196 | 197 | |
| 197 | 198 | ! Get repo and branch info |
@@ -224,15 +225,16 @@ contains |
| 224 | 225 | |
| 225 | 226 | ! Calculate visible items accurately |
| 226 | 227 | ! Fixed UI elements that take screen space: |
| 227 | | - ! Line 1: repo:branch (e.g., "fuss:trunk") |
| 228 | | - ! Line 2: blank line after repo |
| 229 | | - ! Line 3: "." root |
| 230 | | - ! Lines 4 to N-3: tree items (VIEWPORT) |
| 231 | | - ! Line N-2: blank line before help |
| 232 | | - ! Line N-1: help legend (↑=staged ✗=modified ✗=untracked) |
| 233 | | - ! Line N: help controls (j/k/↓/↑: navigate | ...) |
| 234 | | - ! Total fixed: 6 lines (2 + 1 + 3) |
| 235 | | - visible_items = term_height - 6 |
| 228 | + ! top_padding lines: blank padding for terminal compatibility (2-3 lines) |
| 229 | + ! 1 line: repo:branch (e.g., "fuss:trunk") |
| 230 | + ! 1 line: blank line after repo |
| 231 | + ! 1 line: "." root |
| 232 | + ! Lines X to N-3: tree items (VIEWPORT) |
| 233 | + ! 1 line: blank line before help |
| 234 | + ! 1 line: help legend (↑=staged ✗=modified ✗=untracked) |
| 235 | + ! 1 line: help controls (j/k/↓/↑: navigate | ...) |
| 236 | + ! Total fixed: top_padding + 6 lines |
| 237 | + visible_items = term_height - top_padding - 6 |
| 236 | 238 | if (visible_items < 3) visible_items = 3 ! Absolute minimum |
| 237 | 239 | if (visible_items > n_items) visible_items = n_items ! Don't exceed total items |
| 238 | 240 | |
@@ -485,7 +487,7 @@ contains |
| 485 | 487 | ! Force full redraw after filter change |
| 486 | 488 | needs_full_redraw = .true. |
| 487 | 489 | ! Recalculate visible_items in case n_items changed |
| 488 | | - visible_items = term_height - 6 |
| 490 | + visible_items = term_height - top_padding - 6 |
| 489 | 491 | if (visible_items < 3) visible_items = 3 |
| 490 | 492 | if (visible_items > n_items) visible_items = n_items |
| 491 | 493 | case ('q', 'Q') ! Quit |