Skip to content

Commit 79e4236

Browse files
committed
TextFrame(fix[display]): Use shutil for terminal size detection
why: curses KEY_RESIZE only fires on getch(), missing resize events when terminal is resized but no key is pressed what: - Replace stdscr.getmaxyx() with shutil.get_terminal_size() - Remove KEY_RESIZE handling (now redundant) This follows Rich's approach: query terminal size directly via ioctl(TIOCGWINSZ) on each loop iteration, which works reliably in tmux and other terminal multiplexers.
1 parent 398f9fd commit 79e4236

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/libtmux/textframe/core.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import contextlib
1010
import curses
11+
import shutil
1112
import sys
1213
import typing as t
1314
from dataclasses import dataclass, field
@@ -250,7 +251,10 @@ def _curses_display(self, stdscr: curses.window) -> None:
250251

251252
while True:
252253
stdscr.clear()
253-
max_y, max_x = stdscr.getmaxyx()
254+
255+
# Query terminal size directly (handles resize without signals)
256+
term_size = shutil.get_terminal_size()
257+
max_x, max_y = term_size.columns, term_size.lines
254258

255259
# Calculate scroll bounds
256260
max_scroll_y = max(0, len(lines) - max_y + 1)

0 commit comments

Comments
 (0)