NetBSD Problem Report #30978

From www@netbsd.org  Fri Aug 12 15:40:00 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
	id F420863B104; Fri, 12 Aug 2005 15:39:59 +0000 (UTC)
Message-Id: <20050812153959.F420863B104@narn.netbsd.org>
Date: Fri, 12 Aug 2005 15:39:59 +0000 (UTC)
From: zafer@gmx.org
Reply-To: zafer@gmx.org
To: gnats-bugs@netbsd.org
Subject: curses library 
X-Send-Pr-Version: www-1.0

>Number:         30978
>Category:       lib
>Synopsis:       curses library
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 12 15:40:00 +0000 2005
>Closed-Date:    Wed Oct 20 06:37:23 +0000 2021
>Last-Modified:  Wed Oct 20 06:37:23 +0000 2021
>Originator:     Zafer Aydogan
>Release:        3.99.7
>Organization:
>Environment:
i386
>Description:
NetBSD's curses isn't drawing in the lower-right corner,
to avoid scrolling, probably done by shifting a character into the corner.

Please see this Screenshot:
http://images.aydogan.net/dialog_screen.gif

Julian Coleman <jdc@coris.org.uk> replied:
Yes.  This is historical behaviour of our curses library.  It's probably
sensible to remove this now.  Any terminals that can't handle it could
have a capability added to their termcap entry.


>How-To-Repeat:
use misc/dialog to create message box with:
dialog --msgbox "hello world" 10 40 

(see screenshot)

Notice that the lower right corner is black instead of blue.

(Set TERM=xterm to get colors, if you are on a console)

>Fix:

>Release-Note:

>Audit-Trail:
From: Alan Barrett <apb@cequrux.com>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org
Subject: Re: lib/30978: curses library
Date: Fri, 12 Aug 2005 18:07:47 +0200

 >> NetBSD's curses isn't drawing in the lower-right corner,
 >> to avoid scrolling, probably done by shifting a character into the corner.
 > 
 > Yes.  This is historical behaviour of our curses library.  It's probably
 > sensible to remove this now.  Any terminals that can't handle it could
 > have a capability added to their termcap entry.

 Even if it's unsafe to draw in the bottom left corner (due to risk of
 unwanted scrolling), one should be able to adjust the background colour
 by positioning the cursor there and then using clear-to-end-of-line or
 clear-to-end-of-screen (assuming the terminal has the back_color_erase
 capability).

 --apb (Alan Barrett)

From: "Roy Marples" <roy@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/30978 CVS commit: src/lib/libcurses
Date: Fri, 5 Oct 2018 11:59:05 +0000

 Module Name:	src
 Committed By:	roy
 Date:		Fri Oct  5 11:59:05 UTC 2018

 Modified Files:
 	src/lib/libcurses: newwin.c refresh.c

 Log Message:
 curses: allow drawing the lowest right hand cell of the terminal

 This is a historical behaviour that needs fixing
 If any terminal does scroll when drawing in the lowest right hand cell
 of the terminal then an entry should be made in the terminfo database
 (currently there is no standard code) to state that and define
 __SCROLLWIN as before.

 Fixes PR# 30978.


 To generate a diff of this commit:
 cvs rdiff -u -r1.52 -r1.53 src/lib/libcurses/newwin.c
 cvs rdiff -u -r1.88 -r1.89 src/lib/libcurses/refresh.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: PR/30978 CVS commit: src/lib/libcurses
Date: Fri, 5 Oct 2018 17:25:26 +0300

 On Fri, Oct 05, 2018 at 12:00:01 +0000, Roy Marples wrote:

 >  curses: allow drawing the lowest right hand cell of the terminal
 >  
 >  This is a historical behaviour that needs fixing
 >  If any terminal does scroll when drawing in the lowest right hand cell
 >  of the terminal then an entry should be made in the terminfo database
 >  (currently there is no standard code) to state that and define
 >  __SCROLLWIN as before.

 TERM=sun seems to have Concept's :xn: beahvior.  So if you emit a
 character into the lower-right corner the cursor will wrap and the
 screen will scroll up.  That is using naive test with running cat(1)
 and entering characters on Solaris 11 console.

 I'd expect our wsemul_sun to do the same but I can only test a bit
 later.

 -uwe

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: PR/30978 CVS commit: src/lib/libcurses
Date: Sat, 6 Oct 2018 04:19:43 +0300

 On Fri, Oct 05, 2018 at 17:25:26 +0300, Valery Ushakov wrote:

 > On Fri, Oct 05, 2018 at 12:00:01 +0000, Roy Marples wrote:
 > 
 > >  curses: allow drawing the lowest right hand cell of the terminal
 > >  
 > >  This is a historical behaviour that needs fixing
 > >  If any terminal does scroll when drawing in the lowest right hand cell
 > >  of the terminal then an entry should be made in the terminfo database
 > >  (currently there is no standard code) to state that and define
 > >  __SCROLLWIN as before.
 > 
 > TERM=sun seems to have Concept's :xn: beahvior.  So if you emit a
 > character into the lower-right corner the cursor will wrap and the
 > screen will scroll up.  That is using naive test with running cat(1)
 > and entering characters on Solaris 11 console.
 > 
 > I'd expect our wsemul_sun to do the same but I can only test a bit
 > later.

 As I expected the new curses is broken with TERM=sun.  Emitting that
 character into the lower-right corner causes the line to wrap and,
 consequenly, the screen contents to scroll up, messing up the display.

 You can test by adding 

     options 	WSEMUL_SUN
     options 	WSEMUL_DEFAULT="\"vt100\""

 to your config and configuring a new screen by either adding an entry
 to /etc/wscons.conf or with e.g.

     wsconscfg -e sun 5

 -uwe

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: PR/30978 CVS commit: src/lib/libcurses
Date: Sat, 6 Oct 2018 06:32:00 +0300

 On Sat, Oct 06, 2018 at 04:19:43 +0300, Valery Ushakov wrote:

 > As I expected the new curses is broken with TERM=sun.  Emitting that
 > character into the lower-right corner causes the line to wrap and,
 > consequenly, the screen contents to scroll up, messing up the display.

 IIRC the common hack^Wsolution for this is to use insertion, either
 smir/rmir or ich1 (or ich).

 E.g. the following will print "AZ" at the lower-right corner on both
 TERM=vt100 and TERM=sun

   tput clear

   # this is intended to be in the lower right corner
   # but emit it one column before
   tput cup $(expr $LINES - 1) $(expr $COLUMNS - 2)
   echo -n Z
   sleep 5

   # re-emit the character that was overwritten by the above
   # shifting 'Z' to its target position at the lower right corner
   tput cup $(expr $LINES - 1) $(expr $COLUMNS - 2)
   tput smir    # enter insert mode - nop is not present
   tput ich1    # insert 1 character - nop is not present
   echo -n A
   tput rmir    # end insert mode - nop is not present

   tput cup 0 0
   sleep 5

 Presence of :xn:LP: in termcap just tells you that you can avoid this
 song and dance and just write to the lower-right corner directly, so
 it's a micro-optimization and if these capabilities are not present,
 the display will still be correct at the cost of a few more bytes sent
 to the terminal.

 -uwe

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/30978 CVS commit: [netbsd-8] src/lib/libcurses
Date: Tue, 9 Oct 2018 09:49:36 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Tue Oct  9 09:49:35 UTC 2018

 Modified Files:
 	src/lib/libcurses [netbsd-8]: newwin.c refresh.c

 Log Message:
 Pull up following revision(s) (requested by roy in ticket #1049):

 	lib/libcurses/refresh.c: revision 1.89
 	lib/libcurses/newwin.c: revision 1.53

 curses: allow drawing the lowest right hand cell of the terminal

 This is a historical behaviour that needs fixing
 If any terminal does scroll when drawing in the lowest right hand cell
 of the terminal then an entry should be made in the terminfo database
 (currently there is no standard code) to state that and define
 __SCROLLWIN as before.

 Fixes PR# 30978.


 To generate a diff of this commit:
 cvs rdiff -u -r1.50.6.1 -r1.50.6.2 src/lib/libcurses/newwin.c
 cvs rdiff -u -r1.88 -r1.88.4.1 src/lib/libcurses/refresh.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/30978 CVS commit: [netbsd-8] src/lib/libcurses
Date: Tue, 9 Oct 2018 10:01:38 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Tue Oct  9 10:01:38 UTC 2018

 Modified Files:
 	src/lib/libcurses [netbsd-8]: newwin.c refresh.c

 Log Message:
 Back out the following revision(s) (requested by roy in ticket #1049):

 	lib/libcurses/refresh.c: revision 1.89
 	lib/libcurses/newwin.c: revision 1.53

   curses: allow drawing the lowest right hand cell of the terminal

   This is a historical behaviour that needs fixing
   If any terminal does scroll when drawing in the lowest right hand cell
   of the terminal then an entry should be made in the terminfo database
   (currently there is no standard code) to state that and define
   __SCROLLWIN as before.

   Fixes PR# 30978.

 As discussed in the PR, this change introduces a regression.


 To generate a diff of this commit:
 cvs rdiff -u -r1.50.6.2 -r1.50.6.3 src/lib/libcurses/newwin.c
 cvs rdiff -u -r1.88.4.1 -r1.88.4.2 src/lib/libcurses/refresh.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Roy Marples" <roy@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/30978 CVS commit: src/lib/libcurses
Date: Wed, 10 Oct 2018 09:40:11 +0000

 Module Name:	src
 Committed By:	roy
 Date:		Wed Oct 10 09:40:11 UTC 2018

 Modified Files:
 	src/lib/libcurses: newwin.c refresh.c

 Log Message:
 curses: test terminal capabilities for drawing in the bottom right corner

 If auto margins are present, we need to turn them off or enter
 an insert mode to "push" the character we want into the corner.
 If pushing a wide character of greater than one cell, we need something
 more than ich1, othewise the bottom right corner will remain blank.

 Follow on fix for PR# 30978.

 OK jdc@


 To generate a diff of this commit:
 cvs rdiff -u -r1.53 -r1.54 src/lib/libcurses/newwin.c
 cvs rdiff -u -r1.89 -r1.90 src/lib/libcurses/refresh.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: PR/30978 CVS commit: src/lib/libcurses
Date: Thu, 11 Oct 2018 23:58:27 +0300

 On Wed, Oct 10, 2018 at 09:45:00 +0000, Roy Marples wrote:

 >  Module Name:	src
 >  Committed By:	roy
 >  Date:		Wed Oct 10 09:40:11 UTC 2018
 >  
 >  Modified Files:
 >  	src/lib/libcurses: newwin.c refresh.c
 >  
 >  Log Message:
 >  curses: test terminal capabilities for drawing in the bottom right corner
 >  
 >  If auto margins are present, we need to turn them off or enter
 >  an insert mode to "push" the character we want into the corner.
 >  If pushing a wide character of greater than one cell, we need something
 >  more than ich1, othewise the bottom right corner will remain blank.
 >  
 >  Follow on fix for PR# 30978.
 >  
 >  OK jdc@
 >  
 >  
 >  To generate a diff of this commit:
 >  cvs rdiff -u -r1.53 -r1.54 src/lib/libcurses/newwin.c
 >  cvs rdiff -u -r1.89 -r1.90 src/lib/libcurses/refresh.c

 I've tested this on our wsemul_sun and on solaris console and it
 helps.

 But not completely.  The corner case it doesn't handle is alt-charset.

     dailog --no-shadow --msgbox "hello world" $(stty size)

 On xterm-color the characters in the last and last-but-one columns are
 not in alt-charset.

 In ascii art approximation I get:

        |
     --qj

 or, with msgbox width that is one less than the terminal size:

      |
     -j

 That 'j' also has different colors in this latter case.

 -uwe

From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: PR/30978 CVS commit: src/lib/libcurses
Date: Fri, 12 Oct 2018 00:19:50 +0300

 On Thu, Oct 11, 2018 at 23:58:27 +0300, Valery Ushakov wrote:

 >      |
 >     -j
 > 
 > That 'j' also has different colors in this latter case.

 In general, the char just left of the corner always has the attributes
 of the char in the corner.

 -uwe

From: "Roy Marples" <roy@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/30978 CVS commit: src/lib/libcurses
Date: Sun, 21 Oct 2018 12:47:33 +0000

 Module Name:	src
 Committed By:	roy
 Date:		Sun Oct 21 12:47:33 UTC 2018

 Modified Files:
 	src/lib/libcurses: refresh.c

 Log Message:
 curses: ensure attributes are correctly set for each character

 Another fix for PR# 30978.


 To generate a diff of this commit:
 cvs rdiff -u -r1.90 -r1.91 src/lib/libcurses/refresh.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: blymn@NetBSD.org
State-Changed-When: Wed, 20 Oct 2021 06:37:23 +0000
State-Changed-Why:
It looks like Roy fixed this a few years ago.
The dialog test works correctly for me.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.