NetBSD Problem Report #56664
From www@netbsd.org Mon Jan 24 07:59:54 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id B03691A9239
for <gnats-bugs@gnats.NetBSD.org>; Mon, 24 Jan 2022 07:59:54 +0000 (UTC)
Message-Id: <20220124075953.8F31B1A923A@mollari.NetBSD.org>
Date: Mon, 24 Jan 2022 07:59:53 +0000 (UTC)
From: ak@akkartik.com
Reply-To: ak@akkartik.com
To: gnats-bugs@NetBSD.org
Subject: curses getch() doesn't wait for keystroke when cursor is at bottom right of window
X-Send-Pr-Version: www-1.0
>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: blymn
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 24 08:00:01 +0000 2022
>Closed-Date: Thu May 05 07:25:37 +0000 2022
>Last-Modified: Thu May 05 12:55: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:/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:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: lib-bug-people->blymn
Responsible-Changed-By: blymn@NetBSD.org
Responsible-Changed-When: Tue, 03 May 2022 22:23:16 +0000
Responsible-Changed-Why:
I will claim this bug.
State-Changed-From-To: open->closed
State-Changed-By: blymn@NetBSD.org
State-Changed-When: Thu, 05 May 2022 07:25:37 +0000
State-Changed-Why:
This is not a bug but expected behaviour. The sample code positions
the curses at the bottom right of the window, scrolling is turned off and
getch is expected to echo a character which it cannot do.
From: "Kartik Agaram" <ak@akkartik.com>
To: gnats-bugs@netbsd.org, blymn@netbsd.org, netbsd-bugs@netbsd.org,
gnats-admin@netbsd.org
Cc:
Subject: Re: lib/56664 (curses getch() doesn't wait for keystroke when cursor is at
bottom right of window)
Date: Thu, 05 May 2022 05:50:26 -0700
Thank you for looking into it.
On some other platforms (albeit with ncurses) I see a cursor blinking at the bottom right of the page until I press a key. I was assuming my keypress would be echoed where the cursor is displayed. Did you mean there's no place to display the cursor after echoing the current keypress?
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.