@@ -535,15 +535,17 @@ contains |
| 535 | 535 | end if |
| 536 | 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 | 545 | ! Check if tab bar visibility changed (1 <-> 2+ tabs) |
| 539 | 546 | ! If so, resize all terminals to account for new available height |
| 540 | 547 | if ((old_count == 1 .and. tab_mgr%count > 1) .or. & |
| 541 | 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 | 549 | new_term_rows = (win_height - effective_bar_height) / cell_height |
| 548 | 550 | if (new_term_rows /= term_rows) then |
| 549 | 551 | term_rows = new_term_rows |
@@ -555,12 +557,14 @@ contains |
| 555 | 557 | end do |
| 556 | 558 | end do |
| 557 | 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 | 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 | 568 | ! Update pointers after tab change |
| 565 | 569 | term => tab_manager_get_active_term(tab_mgr) |
| 566 | 570 | active_pty => tab_manager_get_active_pty(tab_mgr) |