Calculate how many rows the tab bar uses
(self)
| 97 | self.stdscr.attroff(curses.color_pair(1) | curses.A_BOLD) |
| 98 | |
| 99 | def _get_tab_bar_height(self): |
| 100 | """Calculate how many rows the tab bar uses""" |
| 101 | height, width = self.stdscr.getmaxyx() |
| 102 | y = 1 |
| 103 | x = 0 |
| 104 | |
| 105 | for i, tab in enumerate(self.tabs): |
| 106 | tab_text = " %s " % tab['title'] |
| 107 | |
| 108 | # Check if tab exceeds width, wrap to next line |
| 109 | if x + len(tab_text) >= width: |
| 110 | y += 1 |
| 111 | x = 0 |
| 112 | # Stop if we've used too many lines |
| 113 | if y >= 3: |
| 114 | break |
| 115 | |
| 116 | x += len(tab_text) + 1 |
| 117 | |
| 118 | return y |
| 119 | |
| 120 | def _draw_tabs(self): |
| 121 | """Draw the tab bar""" |