NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/47399: menu(3) positions the cursor strange when menu is larger than item array
>Number: 47399
>Category: lib
>Synopsis: menu(3) positions the cursor strange when menu is larger than
>item array
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 03 22:50:00 +0000 2013
>Originator: Julian Fagir
>Release: 6.0-RELEASE
>Organization:
>Environment:
>Description:
When you make the menu format larger than the number of options, the cursor
positioning is in the beginning *somewhere*, but not on the options.
If you make the menu format smaller or equal to the number of options, then the
cursor is on the options right from the beginning on.
>How-To-Repeat:
Compile the following program, see how it works with ncurses (everything is
fine), and that when you use it with nbcurses, it will position the cursor on
the right below the last option.
If you change the line
set_menu_format(menu, 3, 1);
to
set_menu_format(menu, 2, 1);
the positioning will be right.
#include <menu.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
int
main(int arg, char *argv[])
{
int ch, j, i = 0;
WINDOW *mainwin, *subwin;
ITEM *items[3];
MENU *menu;
initscr();
keypad(stdscr, TRUE);
noecho();
cbreak();
mainwin = newwin(20, 70, 2, 2);
subwin = derwin(mainwin, 15, 60, 2, 2);
keypad(mainwin, TRUE);
box(mainwin, 0, 0);
mvwprintw(mainwin, 1, 1, "Creating window...");
items[0] = new_item("Bl1", NULL);
set_item_userptr(items[0], (void *)5);
items[1] = new_item("Bl2", NULL);
set_item_userptr(items[0], (void *)6);
items[2] = NULL;
menu = new_menu(items);
set_menu_win(menu, mainwin);
set_menu_sub(menu, subwin);
set_menu_format(menu, 3, 1);
post_menu(menu);
refresh();
wrefresh(mainwin);
wrefresh(subwin);
while ((ch = getch()) != '\n') {
switch (ch) {
case KEY_DOWN:
menu_driver(menu, REQ_NEXT_ITEM);
break;
case KEY_UP:
menu_driver(menu, REQ_PREV_ITEM);
break;
}
wrefresh(mainwin);
wrefresh(subwin);
}
free_item(items[0]);
unpost_menu(menu);
free_menu(menu);
endwin();
return 0;
}
>Fix:
Home |
Main Index |
Thread Index |
Old Index