aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSam Ravnborg <sam@neptun.ravnborg.org>2006-09-02 16:01:42 -0400
committerSam Ravnborg <sam@neptun.ravnborg.org>2006-09-30 05:19:20 -0400
commit737ecae264bc759e2033d99e99138f690f3beabf (patch)
tree55193f039f5ddfe55b391bbaecca308671532ae2 /scripts
parentc29121b787f533d135ae47b5f3044adb66cbebef (diff)
kconfig/lxdialog: clear long menu lines
Menulines that were wider than the available line width is now properly null terminated. While at it renamed the variable choice => line_y so it better reflect the usage in do_print_item(). Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/lxdialog/menubox.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index fcd95a985328..0d83159d9012 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -63,19 +63,19 @@ static int menu_width, item_x;
63/* 63/*
64 * Print menu item 64 * Print menu item
65 */ 65 */
66static void do_print_item(WINDOW * win, const char *item, int choice, 66static void do_print_item(WINDOW * win, const char *item, int line_y,
67 int selected, int hotkey) 67 int selected, int hotkey)
68{ 68{
69 int j; 69 int j;
70 char *menu_item = malloc(menu_width + 1); 70 char *menu_item = malloc(menu_width + 1);
71 71
72 strncpy(menu_item, item, menu_width - item_x); 72 strncpy(menu_item, item, menu_width - item_x);
73 menu_item[menu_width] = 0; 73 menu_item[menu_width - item_x] = '\0';
74 j = first_alpha(menu_item, "YyNnMmHh"); 74 j = first_alpha(menu_item, "YyNnMmHh");
75 75
76 /* Clear 'residue' of last item */ 76 /* Clear 'residue' of last item */
77 wattrset(win, dlg.menubox.atr); 77 wattrset(win, dlg.menubox.atr);
78 wmove(win, choice, 0); 78 wmove(win, line_y, 0);
79#if OLD_NCURSES 79#if OLD_NCURSES
80 { 80 {
81 int i; 81 int i;
@@ -86,14 +86,14 @@ static void do_print_item(WINDOW * win, const char *item, int choice,
86 wclrtoeol(win); 86 wclrtoeol(win);
87#endif 87#endif
88 wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); 88 wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
89 mvwaddstr(win, choice, item_x, menu_item); 89 mvwaddstr(win, line_y, item_x, menu_item);
90 if (hotkey) { 90 if (hotkey) {
91 wattrset(win, selected ? dlg.tag_key_selected.atr 91 wattrset(win, selected ? dlg.tag_key_selected.atr
92 : dlg.tag_key.atr); 92 : dlg.tag_key.atr);
93 mvwaddch(win, choice, item_x + j, menu_item[j]); 93 mvwaddch(win, line_y, item_x + j, menu_item[j]);
94 } 94 }
95 if (selected) { 95 if (selected) {
96 wmove(win, choice, item_x + 1); 96 wmove(win, line_y, item_x + 1);
97 } 97 }
98 free(menu_item); 98 free(menu_item);
99 wrefresh(win); 99 wrefresh(win);