From: nhmall Date: Fri, 24 Jun 2022 00:35:43 +0000 (-0400) Subject: refresh content between really long menu pages X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=010eabcf380811d3219dab82e45db8ac187a958e;p=nethack refresh content between really long menu pages For a long while, I've noticed that if the first page of corner menu is quite long, and the second page is much shorter, the content obliterated by the first page is left missing until the menu is fully dismissed. This attempts to fix that missing content up. =========================================================================== BEFORE THIS PATCH - menu Page 1 =========================================================================== Amulets J - a circular amulet ------------ Weapons |..........| ------- a - a +0 two-handed sword (weapon in hands) |..........| |...... b - a +0 axe (alternate weapon; not wielded) #...........| #....... w - 7 orcish arrows #|{..........#######|...... G - a battle-axe #------------ |...... P - 7 ya ### ------- Armor ## c - an uncursed +0 ring mail (being worn) # E - a splint mail # Comestibles ------# d - an uncursed food ration |.....# f - 6 food rations |....| h - 2 sprigs of wolfsbane |....| i - a cream pie |....-### k - 3 tripe rations |.<..| ###### ############## Scrolls |.d@..######################## r - a scroll labeled ETAOIN SHRDLU ------ #### u - a scroll labeled PHOL ENDE WODAN #### z - a scroll labeled XIXAXA XOXAXA XUXAXA Spellbooks Wizard the Plunderer St: o - a tan spellbook Dlvl:1 $:0 HP:16(16) Pw:2(2) AC:7 q - a wrinkled spellbook v - a thin spellbook ---------------------------------- x - a plain spellbook |a - +0 two-handed sword (weapon i y - a tan spellbook |b - +0 axe (alternate weapon; not H - an indigo spellbook |c - uncursed +0 ring mail (being W - a light blue spellbook |d - uncursed food ration X - a velvet spellbook |e - uncursed oil lamp Potions |f - 6 food rations g - a brilliant blue potion |g - brilliant blue potion j - a fizzy potion |h - 2 sprigs of wolfsbane m - an effervescent potion |i - cream pie B - 2 golden potions |j - fizzy potion D - a dark green potion |k - 3 tripe rations I - a bubbly potion |l - moonstone ring Rings |m - effervescent potion l - a moonstone ring |n - tiger eye ring n - a tiger eye ring |o - tan spellbook Y - a topaz ring |p - tinning kit Wands |q - wrinkled spellbook s - a crystal wand |r - scroll labeled ETAOIN SHRDLU Tools |s - crystal wand e - an uncursed oil lamp |t - oil lamp p - a tinning kit |u - scroll labeled PHOL ENDE WODA t - an oil lamp |v - thin spellbook A - a stethoscope |w - 7 orcish arrows C - a bugle |x - plain spellbook F - an oil lamp |y - tan spellbook Gems/Stones |z - scroll labeled XIXAXA XOXAXA L - 4 blue gems ---------------------------------- (1 of 2) =========================================================================== BEFORE THIS PATCH - menu Page 2 While the second page is displayed, there are gaping missing portions of the map, status lines, and now the tty perm_invent window. =========================================================================== V - a white gem (2 of 2) ------------ |..........| ------- |..........| |...... #...........| #....... #|{..........#######|...... #------------ |...... ### ------- ## # # ------# |.....# |....| |....| |....-### |.<..| ###### ############## |.d@..######################## ------ #### #### Wizard the Plunderer St: Dlvl:1 $:0 HP:16(16) Pw:2(2) AC:7 ---------------------------------- |a - +0 two-handed sword (weapon i |b - +0 axe (alternate weapon; not |c - uncursed +0 ring mail (being |d - uncursed food ration |e - uncursed oil lamp |f - 6 food rations |g - brilliant blue potion |h - 2 sprigs of wolfsbane |i - cream pie |j - fizzy potion |k - 3 tripe rations |l - moonstone ring |m - effervescent potion |n - tiger eye ring |o - tan spellbook |p - tinning kit |q - wrinkled spellbook |r - scroll labeled ETAOIN SHRDLU |s - crystal wand |t - oil lamp |u - scroll labeled PHOL ENDE WODA |v - thin spellbook |w - 7 orcish arrows |x - plain spellbook |y - tan spellbook |z - scroll labeled XIXAXA XOXAXA ---------------------------------- =========================================================================== AFTER THIS PATCH - menu Page 2 The obliterated content of the map, status lines, and tty perm_invent are refreshed prior to displaying menu Page 2. =========================================================================== V - a white gem (2 of 2) ------------ ---------------- |..........| --------------- #...............| |..........| |.............| #|..............| #...........| #..............| #|........^.....| #|{..........#######|.........{...| #-+-------------- #------------ |.............| ############### ### -------------.- # # ## # # ##### # ## ----------# --------.- # # #+........|# |........| ------# # ###|.........# |........| |.....# # # # |...>....| ####.........| |....| ----.--######..........#### |........| |....| |.....|# ---------- |........| |....-### |.....|# # |........| |.<..| ###### ###############+......# ---------- |.d@..#########################|.....|# ------ #### -------# ############# Wizard the Plunderer St:18/01 Dx:16 Co:18 In:8 Wi:8 Ch:6 Chaotic Dlvl:1 $:0 HP:16(16) Pw:2(2) AC:7 Xp:1 Stressed ------------------------------------------------------------------------------ |a - +0 two-handed sword (weapon in hands|A - stethoscope | |b - +0 axe (alternate weapon; not wielde|B - 2 golden potions | |c - uncursed +0 ring mail (being worn) |C - bugle | |d - uncursed food ration |D - dark green potion | |e - uncursed oil lamp |E - splint mail | |f - 6 food rations |F - oil lamp | |g - brilliant blue potion |G - battle-axe | |h - 2 sprigs of wolfsbane |H - indigo spellbook | |i - cream pie |I - bubbly potion | |j - fizzy potion |J - circular amulet | |k - 3 tripe rations |L - 4 blue gems | |l - moonstone ring |P - 7 ya | |m - effervescent potion |V - white gem | |n - tiger eye ring |W - light blue spellbook | |o - tan spellbook |X - velvet spellbook | |p - tinning kit |Y - topaz ring | |q - wrinkled spellbook | | |r - scroll labeled ETAOIN SHRDLU | | |s - crystal wand | | |t - oil lamp | | |u - scroll labeled PHOL ENDE WODAN | | |v - thin spellbook | | |w - 7 orcish arrows | | |x - plain spellbook | | |y - tan spellbook | | |z - scroll labeled XIXAXA XOXAXA XUXAXA | | ------------------------------------------------------------------------------ --- diff --git a/include/wintty.h b/include/wintty.h index 55d86f61a..552684d4c 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -208,7 +208,7 @@ E void putsyms(const char *); #ifdef CLIPPING E void setclipped(void); #endif -E void docorner(int, int); +E void docorner(int, int, int); E void end_glyphout(void); E void g_putch(int); #ifdef ENHANCED_SYMBOLS diff --git a/win/tty/topl.c b/win/tty/topl.c index fecdf665e..69f965e92 100644 --- a/win/tty/topl.c +++ b/win/tty/topl.c @@ -233,7 +233,7 @@ more(void) } if (ttyDisplay->toplin && cw->cury) { - docorner(1, cw->cury + 1); + docorner(1, cw->cury + 1, 0); cw->curx = cw->cury = 0; home(); } else if (morc == '\033') { @@ -271,8 +271,8 @@ update_topl(register const char *bp) if (ttyDisplay->toplin == TOPLINE_NEED_MORE) { more(); } else if (cw->cury) { /* for toplin==TOPLINE_NON_EMPTY && cury > 1 */ - docorner(1, cw->cury + 1); /* reset cury = 0 if redraw screen */ - cw->curx = cw->cury = 0; /* from home--cls() & docorner(1,n) */ + docorner(1, cw->cury + 1, 0); /* reset cury = 0 if redraw screen */ + cw->curx = cw->cury = 0; /* from home--cls() & docorner(1,n,0) */ } } remember_topl(); diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 96d590ef9..4f94704ae 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1758,7 +1758,7 @@ erase_menu_or_text(winid window, struct WinDesc *cw, boolean clear) flush_screen(1); } } else { - docorner((int) cw->offx, cw->maxrow + 1); + docorner((int) cw->offx, cw->maxrow + 1, 0); } } @@ -1829,7 +1829,7 @@ tty_clear_nhwindow(winid window) home(); cl_end(); if (cw->cury) - docorner(1, cw->cury + 1); + docorner(1, cw->cury + 1, 0); ttyDisplay->toplin = TOPLINE_EMPTY; } break; @@ -2092,7 +2092,7 @@ process_menu_window(winid window, struct WinDesc *cw) { tty_menu_item *page_start, *page_end, *curr; long count; - int n, attr_n, curr_page, page_lines, resp_len; + int n, attr_n, curr_page, page_lines, resp_len, previous_page_lines; boolean finished, counting, reset_count; char *cp, *rp, resp[QBUFSZ], gacc[QBUFSZ], *msave, *morestr, really_morc; #define MENU_EXPLICIT_CHOICE 0x7f /* pseudo menu manipulation char */ @@ -2105,6 +2105,7 @@ process_menu_window(winid window, struct WinDesc *cw) count = 0L; reset_count = TRUE; finished = FALSE; + previous_page_lines = 0; /* collect group accelerators; for PICK_NONE, they're ignored; for PICK_ONE, only those which match exactly one entry will be @@ -2244,8 +2245,16 @@ process_menu_window(winid window, struct WinDesc *cw) tty_curs(window, 1, n); cl_end(); } + /* + * If this corner menu was big, there are likely large + * portions of the map, status window, and tty perm_invent + * window (is there is one), that are all missing a lot of + * 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); } - /* set extra chars.. */ Strcat(resp, default_menu_cmds); Strcat(resp, " "); /* next page or end */ @@ -2333,6 +2342,7 @@ process_menu_window(winid window, struct WinDesc *cw) case ' ': case MENU_NEXT_PAGE: if (cw->npages > 0 && curr_page != cw->npages - 1) { + previous_page_lines = page_lines; curr_page++; page_start = 0; } else if (morc == ' ') { @@ -3820,10 +3830,17 @@ tty_wait_synch(void) } void -docorner(register int xmin, register int ymax) +docorner(register int xmin, register int ymax, int ystart_between_menu_pages) { register int y; register struct WinDesc *cw = wins[WIN_MAP]; +#ifdef TTY_PERM_INVENT + struct WinDesc *icw = 0; + int ystart = 0; + + if (g.tty_invent_win != WIN_ERR) + icw = wins[g.tty_invent_win]; +#endif HUPSKIP(); #if 0 /* this optimization is not valuable enough to justify @@ -3842,16 +3859,18 @@ docorner(register int xmin, register int ymax) if (ymax > LI) ymax = LI; /* can happen if window gets smaller */ #endif - for (y = 0; y < ymax; y++) { + if (ystart_between_menu_pages) + ystart = ystart_between_menu_pages; + + for (y = ystart; y < ymax; y++) { tty_curs(BASE_WINDOW, xmin, y); /* move cursor */ - cl_end(); /* clear to end of line */ + if (!ystart_between_menu_pages) + cl_end(); /* clear to end of line */ #ifdef TTY_PERM_INVENT /* the whole thing is beyond the board */ - if (g.tty_invent_win != WIN_ERR && WINDOWPORT("tty")) { - struct WinDesc *icw = wins[g.tty_invent_win]; + if (icw) tty_refresh_inventory(xmin - (int) icw->offx, icw->maxcol, y - (int) icw->offy); - } #endif #ifdef CLIPPING if (y < (int) cw->offy || y + clipy > ROWNO)