projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
scripts/config: sync with linux upstream
[openwrt.git]
/
scripts
/
config
/
lxdialog
/
menubox.c
diff --git
a/scripts/config/lxdialog/menubox.c
b/scripts/config/lxdialog/menubox.c
index
48d382e
..
11ae9ad
100644
(file)
--- a/
scripts/config/lxdialog/menubox.c
+++ b/
scripts/config/lxdialog/menubox.c
@@
-64,7
+64,7
@@
static int menu_width, item_x;
* Print menu item
*/
static void do_print_item(WINDOW * win, const char *item, int line_y,
* Print menu item
*/
static void do_print_item(WINDOW * win, const char *item, int line_y,
-
int selected, int hotkey)
+ int selected, int hotkey)
{
int j;
char *menu_item = malloc(menu_width + 1);
{
int j;
char *menu_item = malloc(menu_width + 1);
@@
-182,7
+182,7
@@
static void do_scroll(WINDOW *win, int *scroll, int n)
* Display a menu for choosing among a number of options
*/
int dialog_menu(const char *title, const char *prompt,
* Display a menu for choosing among a number of options
*/
int dialog_menu(const char *title, const char *prompt,
-
const void *selected, int *s_scroll)
+ const void *selected, int *s_scroll)
{
int i, j, x, y, box_x, box_y;
int height, width, menu_height;
{
int i, j, x, y, box_x, box_y;
int height, width, menu_height;
@@
-193,7
+193,7
@@
int dialog_menu(const char *title, const char *prompt,
do_resize:
height = getmaxy(stdscr);
width = getmaxx(stdscr);
do_resize:
height = getmaxy(stdscr);
width = getmaxx(stdscr);
- if (height <
15 || width < 65
)
+ if (height <
MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN
)
return -ERRDISPLAYTOOSMALL;
height -= 4;
return -ERRDISPLAYTOOSMALL;
height -= 4;
@@
-203,8
+203,8
@@
do_resize:
max_choice = MIN(menu_height, item_count());
/* center dialog box on screen */
max_choice = MIN(menu_height, item_count());
/* center dialog box on screen */
- x = (
COLS
- width) / 2;
- y = (
LINES
- height) / 2;
+ x = (
getmaxx(stdscr)
- width) / 2;
+ y = (
getmaxy(stdscr)
- height) / 2;
draw_shadow(stdscr, y, x, height, width);
draw_shadow(stdscr, y, x, height, width);
@@
-303,10
+303,11
@@
do_resize:
}
}
}
}
- if (i < max_choice ||
- key == KEY_UP || key == KEY_DOWN ||
- key == '-' || key == '+' ||
- key == KEY_PPAGE || key == KEY_NPAGE) {
+ if (item_count() != 0 &&
+ (i < max_choice ||
+ key == KEY_UP || key == KEY_DOWN ||
+ key == '-' || key == '+' ||
+ key == KEY_PPAGE || key == KEY_NPAGE)) {
/* Remove highligt of current item */
print_item(scroll + choice, choice, FALSE);
/* Remove highligt of current item */
print_item(scroll + choice, choice, FALSE);