for menu->bottom_heavy -- insert enough blank lines at top of first page to make the last page become a full one */
| 667 | /* for menu->bottom_heavy -- insert enough blank lines at top of |
| 668 | first page to make the last page become a full one */ |
| 669 | static void |
| 670 | curs_pad_menu( |
| 671 | nhmenu *current_menu, |
| 672 | boolean do_pad UNUSED) |
| 673 | { |
| 674 | nhmenu_item *menu_item_ptr; |
| 675 | int numpages; |
| 676 | |
| 677 | /* caller has already called menu_win_size() */ |
| 678 | menu_determine_pages(current_menu); /* sets 'menu->num_pages' */ |
| 679 | numpages = current_menu->num_pages; |
| 680 | /* pad beginning of menu so that partial last page becomes full; |
| 681 | might be slightly less than full if any entries take multiple |
| 682 | lines and the padding would force those to span page boundary |
| 683 | and that gets prevented; so we re-count the number of pages |
| 684 | with every insertion instead of trying to calculate the number |
| 685 | of them to add */ |
| 686 | do { |
| 687 | menu_item_ptr = curs_new_menu_item(current_menu->wid, ""); |
| 688 | menu_item_ptr->next_item = current_menu->entries; |
| 689 | current_menu->entries->prev_item = menu_item_ptr; |
| 690 | current_menu->entries = menu_item_ptr; |
| 691 | current_menu->num_entries += 1; |
| 692 | |
| 693 | menu_determine_pages(current_menu); |
| 694 | } while (current_menu->num_pages == numpages); |
| 695 | |
| 696 | /* we inserted blank lines at beginning until final entry spilled |
| 697 | over to another page; take the most recent blank one back out */ |
| 698 | current_menu->num_entries -= 1; |
| 699 | current_menu->entries = menu_item_ptr->next_item; |
| 700 | current_menu->entries->prev_item = (nhmenu_item *) 0; |
| 701 | free((genericptr_t) menu_item_ptr->str); |
| 702 | free((genericptr_t) menu_item_ptr); |
| 703 | |
| 704 | /* reset page count; shouldn't need to re-count */ |
| 705 | current_menu->num_pages = numpages; |
| 706 | return; |
| 707 | } |
| 708 | |
| 709 | /* mark ^P message recall menu, for msg_window:full (FIFO), where we'll |
| 710 | start viewing on the last page so be able to see most recent immediately */ |
no test coverage detected