NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/56664: curses getch() doesn't wait for keystroke when cursor is at bottom right of window



>Number:         56664
>Category:       lib
>Synopsis:       curses getch() doesn't wait for keystroke when cursor is at bottom right of window
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 24 08:00:01 +0000 2022
>Originator:     Kartik Agaram
>Release:        9.2
>Organization:
>Environment:
NetBSD rosa.tilde.pink 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
By default, C programs linked with the curses library wait for a keystroke when getch() is called. However, when the cursor is at the bottom right they do not.

I don't see this behavior documented at http://wiki.netbsd.org/curses_in_netbsd
>How-To-Repeat:
Example program

$ cat x.c
#include<curses.h>
int main() {
  initscr();
  move(LINES-1, COLS-1);
  getch();
  endwin();
}

Steps to reproduce:

$ gcc x.c -lcurses
$ ./a.out

Expected behavior: terminal window is clear, cursor at bottom right of window. Upon a keystroke the program exits and returns to shell prompt.

Observed behavior: program immediately exits without waiting for keystroke.

Replacing COLS-1 with COLS-2 yields expected behavior.
>Fix:



Home | Main Index | Thread Index | Old Index