-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Curses terminal resize problems when Python is in interactive mode #46927
Comments
When python is in interactive mode, curses does not react to resize test.py: import curses
def run():
stdscr=curses.initscr()
key=0
while(key!=ord('q')):
key=stdscr.getch()
stdscr.addstr(0,0,str(stdscr.getmaxyx())+' '+str(key))
stdscr.refresh()
curses.endwin()
run() When this is run directly, everything is ok. When it is called via IMHO, the following happens: From the resizeterm man page: Executing import os
os.environ['LINES']="blah"
del os.environ['LINES']
os.environ['COLUMNS']="blah"
del os.environ['COLUMNS'] solves the problem for me. |
Could somebody witht a nix box try this out, I'd do it myself if I had such a beast. |
Well, I can run it, but I have no idea what it is telling me or how it demonstrates a bug. Pavel, is this still a problem in 2.6/2.7? |
Just to confirm: curses SIGWINCH handling is still (2.7/3.2) broken after importing readline. Readline seems to set the LINES/COLUMNS environment vars, and this confuses curses, even if curses is imported after readline. Clearing the LINES/COLUMNS vars after import readline fixes the issue: I spent a couple hours tearing my hair out over this, before I found this report. It may be possible for Python to work around this readline behavior by saving LINES/COLUMNS and restoring them after initializing readline. Or maybe this should just be documented somewhere. |
bpo-3948 is almost certainly a duplicate. |
For the record, this is my interpretation of Pavel’s demo: If you press a key (other than lowercase “q”) or resize the terminal, it displays the terminal dimensions in the top-left corner. Without Readline, the dimensions are updated when the terminal resizes. When Readline is used (interactive mode, or simply “import readline”), the reported dimensions are static, which I understand is the bug. Documentating this quirk may be a good start. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: