Fix an off by one bug in the scale_menu() function.

This commit is contained in:
blymn 2002-11-27 11:53:11 +00:00
parent 2331faab98
commit 6f2e4ed705
2 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: internals.c,v 1.10 2002/07/29 13:03:51 blymn Exp $ */
/* $NetBSD: internals.c,v 1.11 2002/11/27 11:53:11 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
@ -386,7 +386,7 @@ _menui_draw_item(MENU *menu, int item)
wmove(menu->scrwin,
menu->items[item]->row - menu->top_row,
menu->items[item]->col * menu->col_width);
menu->items[item]->col * (menu->col_width + 1));
if (menu->cur_item == item)
wattrset(menu->scrwin, menu->fore);
@ -441,21 +441,22 @@ _menui_draw_item(MENU *menu, int item)
}
menu->items[item]->visible = 1;
/* kill any special attributes... */
wattrset(menu->scrwin, menu->back);
/*
* Fill in the spacing between items, annoying but it looks
* odd if the menu items are inverse because the spacings do not
* have the same attributes as the items.
*/
if (menu->items[item]->col > 0) {
if ((menu->items[item]->col > 0) &&
(menu->items[item]->col < (menu->item_cols - 1))) {
wmove(menu->scrwin,
menu->items[item]->row - menu->top_row,
menu->items[item]->col * menu->col_width - 1);
menu->items[item]->col * (menu->col_width + 1) - 1);
waddch(menu->scrwin, ' ');
}
/* kill any special attributes... */
wattrset(menu->scrwin, menu->back);
/* and position the cursor nicely */
pos_menu_cursor(menu);
}
@ -507,7 +508,7 @@ _menui_draw_menu(MENU *menu)
}
}
wmove(menu->scrwin, row,
col * menu->col_width);
col * (menu->col_width + 1));
for (j = 0; j < menu->col_width; j++)
waddch(menu->scrwin, ' ');
} else {

View File

@ -1,4 +1,4 @@
/* $NetBSD: menu.c,v 1.14 2002/08/22 11:30:18 blymn Exp $ */
/* $NetBSD: menu.c,v 1.15 2002/11/27 11:53:11 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
@ -549,7 +549,7 @@ scale_menu(MENU *param_menu, int *rows, int *cols)
/*
* allow for spacing between columns...
*/
*cols += menu->cols;
*cols += (menu->cols - 1);
return E_OK;
}
@ -731,7 +731,7 @@ pos_menu_cursor(MENU *menu)
maxmark = max(menu->mark.length, menu->unmark.length);
movx = maxmark + (menu->items[menu->cur_item]->col
* menu->col_width);
* (menu->col_width + 1));
if (menu->match_len > 0)
movx += menu->match_len - 1;