~adnano/wmenu

6f15fd886826f075e7dec66dd4611ac418a9e7a9 — Adnan Maolood a month ago b8d626a
menu: Avoid adding zero-size pages

Ensure that pages always have at least one item, even if that item is
too big to fit on any page.
1 files changed, 3 insertions(+), 1 deletions(-)

M menu.c
M menu.c => menu.c +3 -1
@@ 219,11 219,13 @@ static void page_items(struct menu *menu) {
			page->first = item;

			int total_width = 0;
			int items = 0;
			while (item) {
				total_width += item->width + 2 * menu->padding;
				if (total_width > max_width) {
				if (total_width > max_width && items > 0) {
					break;
				}
				items++;

				item->page = page;
				page->last = item;