From: PatR Date: Thu, 29 Sep 2022 20:58:50 +0000 (-0700) Subject: curses: scrollbars on clipped map X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3dea129a3839305ffdb0969c5623b7efeef7d1e9;p=nethack curses: scrollbars on clipped map A change to the curses interface from three years ago to make sure that round-off didn't make the horizontal and vertical clipped map indicators appear to not be clipped was using ROWNO for both instead of COLNO for the horizontal one. For modest clipping the mistake was unnoticeable; I don't know whether that remained true for more extreme clipping. [Not fixed: the curses scrollbar stuff ignores the fact that map column 0 is unused.] --- diff --git a/win/curses/curswins.c b/win/curses/curswins.c index 8491a1e35..e1a8a65c0 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -252,13 +252,7 @@ curses_add_nhwin(winid wid, int height, int width, int y, int x, break; case MAP_WIN: mapwin = win; - - if ((width < COLNO) || (height < ROWNO)) { - map_clipped = TRUE; - } else { - map_clipped = FALSE; - } - + map_clipped = (width < COLNO || height < ROWNO); break; } @@ -656,17 +650,15 @@ curses_draw_map(int sx, int sy, int ex, int ey) if (sx > 0 && sbsx == 0) ++sbsx; - if (ex < ROWNO - 1 && sbex == ROWNO - 1) + if (ex < COLNO - 1 && sbex == COLNO - 1) --sbex; for (count = 0; count < sbsx; count++) { write_char(mapwin, count + bspace, ey - sy + 1 + bspace, hsb_back); } - for (count = sbsx; count <= sbex; count++) { write_char(mapwin, count + bspace, ey - sy + 1 + bspace, hsb_bar); } - for (count = sbex + 1; count <= (ex - sx); count++) { write_char(mapwin, count + bspace, ey - sy + 1 + bspace, hsb_back); } @@ -685,11 +677,9 @@ curses_draw_map(int sx, int sy, int ex, int ey) for (count = 0; count < sbsy; count++) { write_char(mapwin, ex - sx + 1 + bspace, count + bspace, vsb_back); } - for (count = sbsy; count <= sbey; count++) { write_char(mapwin, ex - sx + 1 + bspace, count + bspace, vsb_bar); } - for (count = sbey + 1; count <= (ey - sy); count++) { write_char(mapwin, ex - sx + 1 + bspace, count + bspace, vsb_back); }