MCPcopy Create free account
hub / github.com/NetHack/NetHack / tty_message_menu

Function tty_message_menu

win/tty/wintty.c:2818–2847  ·  view source on GitHub ↗

special hack for treating top line --More-- as a one item menu */

Source from the content-addressed store, hash-verified

2816
2817/* special hack for treating top line --More-- as a one item menu */
2818char
2819tty_message_menu(char let, int how, const char *mesg)
2820{
2821 HUPSKIP_RESULT('\033');
2822 /* "menu" without selection; use ordinary pline, no more() */
2823 if (how == PICK_NONE) {
2824 pline("%s", mesg);
2825 return 0;
2826 }
2827
2828 ttyDisplay->dismiss_more = let;
2829 morc = 0;
2830 /* barebones pline(); since we're only supposed to be called after
2831 response to a prompt, we'll assume that the display is up to date */
2832 tty_putstr(WIN_MESSAGE, 0, mesg);
2833 /* if `mesg' didn't wrap (triggering --More--), force --More-- now */
2834 if (ttyDisplay->toplin == TOPLINE_NEED_MORE) {
2835 more();
2836 ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */
2837 tty_clear_nhwindow(WIN_MESSAGE);
2838 nhassert(ttyDisplay->toplin == TOPLINE_EMPTY);
2839 }
2840 /* normally <ESC> means skip further messages, but in this case
2841 it means cancel the current prompt; any other messages should
2842 continue to be output normally */
2843 wins[WIN_MESSAGE]->flags &= ~WIN_CANCELLED;
2844 ttyDisplay->dismiss_more = 0;
2845
2846 return ((how == PICK_ONE && morc == let) || morc == '\033') ? morc : '\0';
2847}
2848
2849win_request_info *
2850tty_ctrl_nhwindow(

Callers

nothing calls this directly

Calls 4

tty_putstrFunction · 0.85
tty_clear_nhwindowFunction · 0.85
moreFunction · 0.70
plineFunction · 0.50

Tested by

no test coverage detected