mirror of
https://codeberg.org/adnano/wmenu.git
synced 2026-02-04 04:06:20 -05:00
Set height to item count if less items than lines
This patch sets the height to the count of items if the item count
is less than specified lines.
Ex:
printf "Item1\nItem2" | wmenu -l 100
will give wmenu a height of 2 rather than 100 since there is only 2
items.
closes #64
Signed-off-by: FictitiousExistence <>
This commit is contained in:
parent
0a38d45abb
commit
ef7ec99589
1 changed files with 5 additions and 0 deletions
5
menu.c
5
menu.c
|
|
@ -181,6 +181,11 @@ void menu_add_item(struct menu *menu, char *text) {
|
|||
new->text = text;
|
||||
|
||||
menu->item_count++;
|
||||
|
||||
if ((size_t)menu->lines > (menu->item_count - 1)){
|
||||
menu->height = menu->line_height;
|
||||
menu->height += menu->height * menu->item_count;
|
||||
}
|
||||
}
|
||||
|
||||
static int compare_items(const void *a, const void *b) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue