Subject: Re: Curses and function-keys
To: NetBSD netbsd-users mailing list <netbsd-users@netbsd.org>
From: Julian Coleman <jdc@coris.org.uk>
List: netbsd-users
Date: 01/15/2006 15:52:57
> I've read the article
> http://www.linuxfocus.org/English/March2002/article233.shtml recently, and
> compiled the example program described there. I noticed, that under Linux
> control, in 3 different terminals ("linux", "xterm", "eterm") the "example"
> program is working OK.
> 
> Unfortunately, under control of NetBSD it's working properly only in case,
> when "screen" has been run earlier; neither in default vt100 nor in xterm
> window it isn't working OK - there are no colours, and the keys aren't
> properly recognized.

When I run the program in an xterm, I do see colours, but the keys aren't
recognised.  This is because, for our curses, it needs to call cbreak() - I
added this call just after the noecho() line in init_curses().  Possibly, we
should default to cbreak mode when initscr() is called.

There are a few other problems with the program:

  it assumes that the terminal is 80x24.  It should check COLS and LINES

  it calls start_color() and doesn't check the return code, so it will try
  and use colours on terminals that don't support colour (e.g. vt100).

  it deletes the items[0] window and then tries to delete the sub-windows of
  that window.  This causes our curses code to go into a loop.  I'll look at
  fixing this.

It looks like there is another bug in our curses library - when a key is
pressed, the first 80 columns on the bottom row of the screen turn black.
It's probably related to our handling of background attributes versus default
colours, which isn't well tested.  I'll look at that too.

J

-- 
  My other computer also runs NetBSD    /        Sailing at Newbiggin
        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/