[Python-bugs-list] [ python-Bugs-417212 ] curses.newwin can return pads

noreply@sourceforge.net noreply@sourceforge.net
Wed, 11 Jul 2001 15:43:37 -0700


Bugs item #417212, was opened at 2001-04-18 19:22
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=417212&group_id=5470

Category: Extension Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: David M. Cooke (dmcooke)
Assigned to: A.M. Kuchling (akuchling)
Summary: curses.newwin can return pads

Initial Comment:
In 2.1 (at least), curses.newwin can return a pad
object if it's called with two arguments, i.e.

win = curses.newwin(0,0)

Since this is actually a pad, win.refresh has to be
called with six arguments -- the syntax used for
refreshing a pad -- instead of as just win.refresh()

Looking at the code for _cursesmodule.c, it appears
that only win.refresh() and win.noutrefresh() take
different arguments depending on whether win is
actually a window or a pad.

It looks like there are three options here: 

- document that the two-argument version of
curses.newwin returns a pad (and hence the six-argument
.refresh() must be used)

- make curses.newwin take four arguments only (as the
two argument version is currently equivalent to newpad)

- have win.refresh() and win.noutrefresh() do sensible
things for pads (although I don't know what that would
be...)

I would think #2 is the best.

Hmm, perhaps there should be a separate object type for
pads, so we can tell the difference between pads and
windows.

----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2001-07-11 15:43

Message:
Logged In: YES 
user_id=11375

Hmm... another option would be to just use newwin() 
instead of newpad(), and set nlines and ncols to zero, 
making ncurses use the rest of the screen for the window.  
On reflection, I think I like this solution better because 
it makes the code reflect the document behaviour.


----------------------------------------------------------------------

Comment By: A.M. Kuchling (akuchling)
Date: 2001-07-11 15:36

Message:
Logged In: YES 
user_id=11375

I think I agree with your choice of #2. It's also possible 
that the newpad() is a typo
or cut-and-paste error of some sort; it's been there since 
Oliver Andrich's original ncurses module.  I'll add a 
warning to the 2-argument newwin(), and it can disappear 
in Python 2.3.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=417212&group_id=5470