This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: curses.newwin can return pads
Type: Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, dmcooke
Priority: normal Keywords:

Created on 2001-04-19 02:22 by dmcooke, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (4)
msg4357 - (view) Author: David M. Cooke (dmcooke) Date: 2001-04-19 02:22
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.
msg4358 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2001-07-11 22:36
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.
msg4359 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2001-07-11 22:43
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.
msg4360 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2001-07-14 20:39
Logged In: YES 
user_id=11375

Fixed in rev. 2.53 of _cursesmodule.c, by taking my 
suggested second course of action and having newwin()
never return a pad at all.

History
Date User Action Args
2022-04-10 16:03:58adminsetgithub: 34369
2001-04-19 02:22:03dmcookecreate