NetBSD Problem Report #46620

From www@NetBSD.org  Fri Jun 22 10:57:28 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id EEC8963B882
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 22 Jun 2012 10:57:27 +0000 (UTC)
Message-Id: <20120622105726.F34D063B85F@www.NetBSD.org>
Date: Fri, 22 Jun 2012 10:57:26 +0000 (UTC)
From: gnrp@komkon2.de
Reply-To: gnrp@komkon2.de
To: gnats-bugs@NetBSD.org
Subject: curses menu scrolling is broken
X-Send-Pr-Version: www-1.0

>Number:         46620
>Category:       lib
>Synopsis:       curses menu scrolling is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 22 11:00:00 +0000 2012
>Closed-Date:    Fri Aug 24 06:13:23 +0000 2012
>Last-Modified:  Fri Aug 24 06:13:23 +0000 2012
>Originator:     Julian Fagir
>Release:        6.0_BETA
>Organization:
>Environment:
>Description:
Using the menu library from curses, scrolling won't work: When you scroll outside the menu size, entries are shown doubled, once marked, once normal, and everything looks broken.
>How-To-Repeat:
Compile the following program (`cc -lmenu $name`), execute, and scroll more than four lines.


#include <err.h>
#include <errno.h>
#include <menu.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
	ITEM *mitems[50];
	MENU *mmenu;
	WINDOW *msubwin, *mainwin;
	char buf[BUFSIZ];
	int ch, i;

	for (i = 0; i < sizeof(mitems)/sizeof(ITEM *) - 1; i++) {
		snprintf(buf, sizeof buf, " - %d - ", i);
		warnx("%d", i);
		mitems[i] = new_item(buf, NULL);
	}
	mitems[sizeof(mitems)/sizeof(ITEM *) - 1] = NULL;

	initscr();
	keypad(stdscr, TRUE);
	noecho();
	cbreak();
	mmenu = new_menu(mitems);
	mainwin = newwin(24, 79, 1, 1);
	msubwin = derwin(mainwin, 15, 60, 2, 2);
	wborder(mainwin, 0, 0, 0, 0, 0, 0, 0, 0);
	wborder(msubwin, 0, 0, 0, 0, 0, 0, 0, 0);

	set_menu_win(mmenu, mainwin);
	set_menu_sub(mmenu, msubwin);
	set_menu_format(mmenu, 4, 1);
	post_menu(mmenu);
	wrefresh(mainwin);

	while ((ch = getch()) != '\n') {
		switch (ch) {
			case KEY_DOWN:
				menu_driver(mmenu, REQ_NEXT_ITEM);
				break;
			case KEY_UP:
				menu_driver(mmenu, REQ_PREV_ITEM);
				break;
			case KEY_NPAGE:
				menu_driver(mmenu, REQ_SCR_DPAGE);
				break;
			case KEY_PPAGE:
				menu_driver(mmenu, REQ_SCR_UPAGE);
				break;
			case KEY_END:
				menu_driver(mmenu, REQ_LAST_ITEM);
				break;
			case KEY_HOME:
				menu_driver(mmenu, REQ_FIRST_ITEM);
				break;
			case '\b':
				return 1;
				break; /* NOT REACHED */
		}
		wrefresh(mainwin);
	}

	endwin();
	return 0;
}
>Fix:

Update to version 1.15 of internals.c in the libmenu sources.

>Release-Note:

>Audit-Trail:
From: Brett Lymn <blymn@internode.on.net>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: lib/46620: curses menu scrolling is broken
Date: Fri, 22 Jun 2012 22:16:53 +0930

 It looks like the scrolling is broken when the menu option O_ROWMAJOR is
 not set.  This option really only affects the ordering of the menu items
 in a multi-column menu so it shouldn't affect scrolling.  Need to
 investigate why scrolling is affected.  A temporary work around is to
 just set O_ROWMAJOR which would make the given sample work with no real
 side effects since there is only one column in the menu anyway.

 -- 
 Brett Lymn
 Staple Guns: because duct tape doesn't make that KerCHUNK sound - xkcd.com

State-Changed-From-To: open->feedback
State-Changed-By: blymn@NetBSD.org
State-Changed-When: Wed, 27 Jun 2012 11:58:29 +0000
State-Changed-Why:
Bug fixed, awaiting feedback


State-Changed-From-To: feedback->closed
State-Changed-By: blymn@NetBSD.org
State-Changed-When: Fri, 24 Aug 2012 06:13:23 +0000
State-Changed-Why:
no feedback, pullup for 5 and 6 submitted.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.