NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/46620: curses menu scrolling is broken
>Number: 46620
>Category: lib
>Synopsis: curses menu scrolling is broken
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jun 22 11:00:00 +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:
Home |
Main Index |
Thread Index |
Old Index