Message65626
Curses sometimes fails to correctly initialize the terminal.
Unfortunately I don't know how to reproduce the problem, it was reported
multiple times by ipython users, but I have no idea what causes it. I
finally found a workaround by making a termios call that at least
restores terminal state (see attachment), but it's just a workaround,
not a real fix.
The issue manifests itself as follows: at some point (I don't know why),
a call to curses.initscr() doesn't actually set the terminal in the
usual mode where input isn't accepted, but instead the terminal
continues accepting normal input, issuing newlines, etc. The only sign
that curses is active is that in a modern terminal, the scrollbar
changes to fill the screen. After this, calling curses.endwin(),
instead of restoring terminal state, leaves the terminal in the mode
that typically initscr() would put it in: no input is displayed,
printouts swallow end-of-line characters, etc.
When this happened in ipython sessions, we'd just suggest users call
!reset (the system command), which would restore terminal state. But
the problem is obviously in curses itself, because once this problem
appeared, running the attached script would always print 'False' for the
state condition checked there.
For now in IPython we have a workaround, but perhaps with this little
description/example, someone who knows the curses code might be able to
actually fix the real problem. If I find a reliable way to trigger the
bug, I'll add comments here indicating so. |
|
Date |
User |
Action |
Args |
2008-04-18 22:51:09 | fer_perez | set | spambayes_score: 0.0161321 -> 0.016132107 recipients:
+ fer_perez |
2008-04-18 22:51:08 | fer_perez | set | spambayes_score: 0.0161321 -> 0.0161321 messageid: <1208559068.96.0.196247088071.issue2657@psf.upfronthosting.co.za> |
2008-04-18 22:51:07 | fer_perez | link | issue2657 messages |
2008-04-18 22:51:06 | fer_perez | create | |
|