fortrangoingonforty/fuss / eb684f0

Browse files

better support for wezterm (once again)

Authored by espadonne
SHA
eb684f0d6032c3d8a9f00a705b56a021b69afbcf
Parents
d14d0a1
Tree
0a7ea4e

2 changed files

StatusFile+-
M Makefile 5 2
M src/fuss_main.f90 16 14
Makefilemodified
@@ -6,7 +6,7 @@ BUILD_DIR = build
66
 BIN_DIR = .
77
 
88
 # Module files (order matters for dependencies)
9
-MODULES = types_module.f90 terminal_module.f90 git_module.f90 tree_module.f90 display_module.f90
9
+MODULES = types_module.f90 cache_module.f90 terminal_module.f90 git_module.f90 tree_module.f90 display_module.f90
1010
 MODULE_OBJS = $(MODULES:%.f90=$(BUILD_DIR)/%.o)
1111
 
1212
 # Main program
@@ -30,10 +30,13 @@ $(BUILD_DIR):
3030
 $(BUILD_DIR)/types_module.o: $(SRC_DIR)/types_module.f90 | $(BUILD_DIR)
3131
 	$(FC) $(FFLAGS) -J$(BUILD_DIR) -c $< -o $@
3232
 
33
+$(BUILD_DIR)/cache_module.o: $(SRC_DIR)/cache_module.f90 $(BUILD_DIR)/types_module.o | $(BUILD_DIR)
34
+	$(FC) $(FFLAGS) -J$(BUILD_DIR) -I$(BUILD_DIR) -c $< -o $@
35
+
3336
 $(BUILD_DIR)/terminal_module.o: $(SRC_DIR)/terminal_module.f90 | $(BUILD_DIR)
3437
 	$(FC) $(FFLAGS) -J$(BUILD_DIR) -c $< -o $@
3538
 
36
-$(BUILD_DIR)/git_module.o: $(SRC_DIR)/git_module.f90 $(BUILD_DIR)/types_module.o | $(BUILD_DIR)
39
+$(BUILD_DIR)/git_module.o: $(SRC_DIR)/git_module.f90 $(BUILD_DIR)/types_module.o $(BUILD_DIR)/cache_module.o | $(BUILD_DIR)
3740
 	$(FC) $(FFLAGS) -J$(BUILD_DIR) -I$(BUILD_DIR) -c $< -o $@
3841
 
3942
 $(BUILD_DIR)/tree_module.o: $(SRC_DIR)/tree_module.f90 $(BUILD_DIR)/types_module.o | $(BUILD_DIR)
src/fuss_main.f90modified
@@ -184,14 +184,15 @@ contains
184184
         ! Initialize tree pointer
185185
         tree_root => null()
186186
 
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
188189
         call get_environment_variable("TERM_PROGRAM", term_program)
189190
         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
191192
         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
193194
         else
194
-            top_padding = 1  ! Other terminals need 1 line
195
+            top_padding = 2  ! Other terminals need 2 lines
195196
         end if
196197
 
197198
         ! Get repo and branch info
@@ -224,15 +225,16 @@ contains
224225
 
225226
         ! Calculate visible items accurately
226227
         ! 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
236238
         if (visible_items < 3) visible_items = 3  ! Absolute minimum
237239
         if (visible_items > n_items) visible_items = n_items  ! Don't exceed total items
238240
 
@@ -485,7 +487,7 @@ contains
485487
                 ! Force full redraw after filter change
486488
                 needs_full_redraw = .true.
487489
                 ! Recalculate visible_items in case n_items changed
488
-                visible_items = term_height - 6
490
+                visible_items = term_height - top_padding - 6
489491
                 if (visible_items < 3) visible_items = 3
490492
                 if (visible_items > n_items) visible_items = n_items
491493
             case ('q', 'Q')  ! Quit