fortrangoingonforty/fortty / 3fe456d

Browse files

Fix tab switch layout bug - always recalculate active tab layout

When switching tabs, the newly active tab's pane layout wasn't being
recalculated, causing panes to render at y=0 instead of below the tab
bar. Now layout is recalculated after any tab action.
Authored by espadonne
SHA
3fe456dd8ab28508093e5210bfffc04db4ea2e30
Parents
732ba14
Tree
fd8df3c

1 changed file

StatusFile+-
M src/fortty.f90 13 9
src/fortty.f90modified
@@ -535,15 +535,17 @@ contains
535
         end if
535
         end if
536
     end select
536
     end select
537
 
537
 
538
+    ! Calculate effective bar height based on current tab count
539
+    if (tab_mgr%count > 1) then
540
+      effective_bar_height = tab_mgr%bar_height
541
+    else
542
+      effective_bar_height = 0
543
+    end if
544
+
538
     ! Check if tab bar visibility changed (1 <-> 2+ tabs)
545
     ! Check if tab bar visibility changed (1 <-> 2+ tabs)
539
     ! If so, resize all terminals to account for new available height
546
     ! If so, resize all terminals to account for new available height
540
     if ((old_count == 1 .and. tab_mgr%count > 1) .or. &
547
     if ((old_count == 1 .and. tab_mgr%count > 1) .or. &
541
         (old_count > 1 .and. tab_mgr%count == 1)) then
548
         (old_count > 1 .and. tab_mgr%count == 1)) then
542
-      if (tab_mgr%count > 1) then
543
-        effective_bar_height = tab_mgr%bar_height
544
-      else
545
-        effective_bar_height = 0
546
-      end if
547
       new_term_rows = (win_height - effective_bar_height) / cell_height
549
       new_term_rows = (win_height - effective_bar_height) / cell_height
548
       if (new_term_rows /= term_rows) then
550
       if (new_term_rows /= term_rows) then
549
         term_rows = new_term_rows
551
         term_rows = new_term_rows
@@ -555,12 +557,14 @@ contains
555
           end do
557
           end do
556
         end do
558
         end do
557
       end if
559
       end if
558
-      ! Recalculate layout for active tab
559
-      call tab_manager_recalculate_layout(tab_mgr, 0, effective_bar_height, &
560
-                                          win_width, win_height - effective_bar_height, &
561
-                                          cell_width, cell_height)
562
     end if
560
     end if
563
 
561
 
562
+    ! Always recalculate layout for active tab after any tab action
563
+    ! This ensures the pane has correct y-offset when tab bar is visible
564
+    call tab_manager_recalculate_layout(tab_mgr, 0, effective_bar_height, &
565
+                                        win_width, win_height - effective_bar_height, &
566
+                                        cell_width, cell_height)
567
+
564
     ! Update pointers after tab change
568
     ! Update pointers after tab change
565
     term => tab_manager_get_active_term(tab_mgr)
569
     term => tab_manager_get_active_term(tab_mgr)
566
     active_pty => tab_manager_get_active_pty(tab_mgr)
570
     active_pty => tab_manager_get_active_pty(tab_mgr)