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, can't write to loverright corner
Type: Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, nobody
Priority: normal Keywords:

Created on 2001-07-15 11:18 by anonymous, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (3)
msg5412 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-07-15 11:18
Whenever I try to write something to a window that
would cause text to appear in the lower right corner
I get an error
w = curses.newwin(2,10,0,0)
w.addstr(1,9,"X")   ->   
      _curses.error: addstr() returned ERR


w.addch(1,9,ord("x")) ->
      _curses.error: addch() returned ERR

Same behaviour on all versions I tried.
1.5.2
2.1
2.0


ncurses-5.2 if that is of importance.
msg5413 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2001-08-10 20:09
Logged In: YES 
user_id=11375

I believe this is a curses/ncurses limitation and not a 
bug, though  admittedly the limitation doesn't make much 
sense for windows that don't touch the lower-right corner 
of the terminal.  You could try writing the analogous C 
program and see if that also fails to work.

Making the window scrollable with w.scrollok(1) allows 
this to work, at the cost of making the window scroll up 
a line.

msg5414 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-08-10 21:57
Logged In: NO 

Ok, I tried a little program in C.


#include <curses.h>

WINDOW *w;

int i,c,x1,x2,x3;
int main()
{
  initscr();cbreak();noecho();
  
  w = newwin(2,10,0,0);
  c = wgetch(w);
  x1 = mvwprintw(w,0,9,"Y"); /* IS OK */
  x2 = mvwprintw(w,1,9,"Y"); /* IS OK, BUT MIGHT REPORT
WRONG */
  x3 = mvwprintw(w,2,9,"Y"); /* THIS SHOULD NOT WORK */
  wrefresh(w);
  c = wgetch(w);
   
  echo();endwin();nocbreak();
  printf("RETURN VALUES: %d,%d,%d\n",x1,x2,x3);
  return 0;
}


When run, this program produces a screen with an Y on each
of the two first lines, just as expected.
It then ends and prints the output:

RETURN VALUES: 0,-1,-1

The first -1 should, as I see it, have been 0. I assume 
the python code sees the -1 and raises the error?

So yes, this would seem to be an error in curses.

/Magnus.
History
Date User Action Args
2022-04-10 16:04:12adminsetgithub: 34757
2001-07-15 11:18:23anonymouscreate