From: nhmall Date: Fri, 24 Jun 2022 01:48:05 +0000 (-0400) Subject: follow-up on corner menu appearance X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=90e7fdaa4bc9c0c68449ca8f2aa2ac8ccc37900e;p=nethack follow-up on corner menu appearance move variable and its init out of ifdef block add a comment and some range checking --- diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 4f94704ae..193aada84 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2252,8 +2252,18 @@ process_menu_window(winid window, struct WinDesc *cw) * information. Let's repair the blacked-out rows now * because it looks better. */ - if (previous_page_lines != 0 && page_lines < previous_page_lines) - docorner((int) cw->offx, cw->maxrow + 1, page_lines + 3); + if (previous_page_lines != 0 + && page_lines < previous_page_lines) { + /* + * +3 to leave a couple of blank rows + * under the menu to make it contrast well. + */ + int row_startoffset = page_lines + 3; + + if (row_startoffset > cw->maxrow - 1) + row_startoffset = cw->maxrow - 1; + docorner((int) cw->offx, cw->maxrow + 1, row_startoffset); + } } /* set extra chars.. */ Strcat(resp, default_menu_cmds); @@ -3834,9 +3844,9 @@ docorner(register int xmin, register int ymax, int ystart_between_menu_pages) { register int y; register struct WinDesc *cw = wins[WIN_MAP]; + int ystart = 0; #ifdef TTY_PERM_INVENT struct WinDesc *icw = 0; - int ystart = 0; if (g.tty_invent_win != WIN_ERR) icw = wins[g.tty_invent_win];