[ python-Bugs-984870 ] curses: getmaxyx() breaks when the window
shrinks
SourceForge.net
noreply at sourceforge.net
Wed Jul 7 15:19:40 CEST 2004
Bugs item #984870, was opened at 2004-07-04 07:33
Message generated for change (Comment added) made by akuchling
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=984870&group_id=5470
Category: Extension Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthias Klose (doko)
>Assigned to: Nobody/Anonymous (nobody)
Summary: curses: getmaxyx() breaks when the window shrinks
Initial Comment:
[forwarded from http://bugs.debian.org/257472]
When derived windows of stdscr have been created,
shrinking the terminal produces a KEY_RESIZE event, but
getmaxyx() returns the previous terminal size. Only by
increasing the window size does it return the correct
terminal dimensions.
A minimal script to show this effect is included below.
#!/usr/bin/python
import curses, sys
def init_display(stdscr):
stdscr.clear()
stdscr.refresh()
size = stdscr.getmaxyx()
sys.stderr.write("Now %u x %u\n" % (size[1],size[0]))
rootwin = stdscr.derwin(20, 50, 0, 0)
return rootwin
def main(stdscr):
rootwin = init_display(stdscr)
while 1:
input = rootwin.getch()
if ( input == curses.KEY_RESIZE):
init_display(stdscr)
elif input == ord("q"):
sys.exit()
rootwin.refresh()
curses.wrapper(main)
----------------------------------------------------------------------
>Comment By: A.M. Kuchling (akuchling)
Date: 2004-07-07 09:19
Message:
Logged In: YES
user_id=11375
Confirmed. I suspect this is a problem in ncurses, and will
write a C equivalent of the test program to verify this.
The ncurses man page for derwin says: "The subwindow
functions (subwin, derwin, ...) are flaky, incompletely
implemented, and not well tested," so an ncurses bug seems
likely.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=984870&group_id=5470
More information about the Python-bugs-list
mailing list