kconfig/lxdialog/checklist.c
changeset 2882 da77b5e7cb9f
parent 943 1cca90ce0481
     1.1 --- a/kconfig/lxdialog/checklist.c	Fri Oct 17 12:47:53 2008 +0000
     1.2 +++ b/kconfig/lxdialog/checklist.c	Mon Feb 13 21:10:06 2012 +0100
     1.3 @@ -31,6 +31,10 @@
     1.4  static void print_item(WINDOW * win, int choice, int selected)
     1.5  {
     1.6  	int i;
     1.7 +	char *list_item = malloc(list_width + 1);
     1.8 +
     1.9 +	strncpy(list_item, item_str(), list_width - item_x);
    1.10 +	list_item[list_width - item_x] = '\0';
    1.11  
    1.12  	/* Clear 'residue' of last item */
    1.13  	wattrset(win, dlg.menubox.atr);
    1.14 @@ -41,16 +45,18 @@
    1.15  	wmove(win, choice, check_x);
    1.16  	wattrset(win, selected ? dlg.check_selected.atr
    1.17  		 : dlg.check.atr);
    1.18 -	wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' ');
    1.19 +	if (!item_is_tag(':'))
    1.20 +		wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' ');
    1.21  
    1.22  	wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr);
    1.23 -	mvwaddch(win, choice, item_x, item_str()[0]);
    1.24 +	mvwaddch(win, choice, item_x, list_item[0]);
    1.25  	wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
    1.26 -	waddstr(win, (char *)item_str() + 1);
    1.27 +	waddstr(win, list_item + 1);
    1.28  	if (selected) {
    1.29  		wmove(win, choice, check_x + 1);
    1.30  		wrefresh(win);
    1.31  	}
    1.32 +	free(list_item);
    1.33  }
    1.34  
    1.35  /*
    1.36 @@ -174,6 +180,7 @@
    1.37  	check_x = 0;
    1.38  	item_foreach()
    1.39  		check_x = MAX(check_x, strlen(item_str()) + 4);
    1.40 +	check_x = MIN(check_x, list_width);
    1.41  
    1.42  	check_x = (list_width - check_x) / 2;
    1.43  	item_x = check_x + 4;