From 3bd46a353698fffffb69533b45ff3dfa1cccf561 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 25 Jun 2019 02:30:27 -0700 Subject: [PATCH 1/3] curses cursor Followup to 1c03d0970115c776d1c4791fea3c33f70b0b5378; that had been too easy. When map was clipped and panned to the side, the highlight for hero's spot was shown next to the '@' instead of on it. --- doc/fixes36.3 | 5 ++++- win/curses/cursmisc.c | 7 +++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index fcfafe0ab..a96d543d0 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.69 $ $NHDT-Date: 1561429723 2019/06/25 02:28:43 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.70 $ $NHDT-Date: 1561455021 2019/06/25 09:30:21 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -104,6 +104,9 @@ for wizard mode 'wizweight' option, glob weight wasn't shown unless glob had fix for feedback when a monster plays a fire horn at self to cure green slime ended up being used for zapping a wand of fire at self too curses: sometimes the message window would show a blank line after a prompt +curses: the change to show map in columns 1..79 instead of 2..80 made the + highlight for '@' show up in the wrong place if clipped map had been + panned horizontally tty: revert the attempt to fix "message line anomaly: if autodecribe feedback wrapped to second line, the wrapped portion wasn't erased when a shorter line was shown or getpos was dismissed" because it disrupted diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 2991c61d7..f7f08913b 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -519,8 +519,6 @@ curses_move_cursor(winid wid, int x, int y) if (wid != MAP_WIN) { return; - } else { - --x; /* map column [0] isn't used, so shift everything over 1 col */ } #ifdef PDCURSES /* PDCurses seems to not handle wmove correctly, so we use move and @@ -536,8 +534,9 @@ curses_move_cursor(winid wid, int x, int y) curs_y++; } - if ((x >= sx) && (x <= ex) && (y >= sy) && (y <= ey)) { - curs_x -= sx; + if (x >= sx && x <= ex && y >= sy && y <= ey) { + /* map column #0 isn't used; shift column #1 to first screen column */ + curs_x -= (sx + 1); curs_y -= sy; #ifdef PDCURSES move(curs_y, curs_x); From 4f0b1262c555c05ab6c51bcd70164be0d2df6a3e Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 25 Jun 2019 03:17:47 -0700 Subject: [PATCH 2/3] curses clipped map 'scrollbars' The position bars shown by curses when the map is clipped weren't being drawn as intended (integer arithmetic). Changing parentheses was enough to get it working, but it didn't handle the edge case where non-zero got rounded to 0 (so when map was panned down, the uppermost character of the vertical position bar still showed '*', falsely indicating that top of map was currently within view. --- doc/fixes36.3 | 7 ++++++- win/curses/curswins.c | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index a96d543d0..8d778b1c9 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.70 $ $NHDT-Date: 1561455021 2019/06/25 09:30:21 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.71 $ $NHDT-Date: 1561457861 2019/06/25 10:17:41 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -151,6 +151,11 @@ curses: make text windows wider so that help feedback is more readable curses: using ':' for search string matching to toggle menu items in a multple page menu would highlight arbitrary items on the currently visible page in sync with the lines that matching items had on other pages +curses: when map window was clipped, the 'scrollbars' shown to indicate which + part of the map was in view didn't work as intended, always drawing + "*--------------" for horizontal (and comparable '*' with multiple '|' + underneath for vertical) when it meant to show "---******------" if + the 2nd and 3rd fifths (for example) were currently within view curses+'perm_invent': entries were wrapping without any control; usually not noticeable because next entry overwrote, but visible for final entry when whole inventory fit within the available height; looked ok with diff --git a/win/curses/curswins.c b/win/curses/curswins.c index 9599b4de8..006589510 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -624,9 +624,14 @@ curses_draw_map(int sx, int sy, int ex, int ey) vsb_bar.attr = A_NORMAL; /* Horizontal scrollbar */ - if ((sx > 0) || (ex < (COLNO - 1))) { - sbsx = (sx * ((long) (ex - sx + 1) / COLNO)); - sbex = (ex * ((long) (ex - sx + 1) / COLNO)); + if (sx > 0 || ex < (COLNO - 1)) { + sbsx = (int) (((long) sx * (long) (ex - sx + 1)) / (long) COLNO); + sbex = (int) (((long) ex * (long) (ex - sx + 1)) / (long) COLNO); + + if (sx > 0 && sbsx == 0) + ++sbsx; + if (ex < ROWNO - 1 && sbex == ROWNO - 1) + --sbex; for (count = 0; count < sbsx; count++) { write_char(mapwin, count + bspace, ey - sy + 1 + bspace, hsb_back); @@ -642,9 +647,14 @@ curses_draw_map(int sx, int sy, int ex, int ey) } /* Vertical scrollbar */ - if ((sy > 0) || (ey < (ROWNO - 1))) { - sbsy = (sy * ((long) (ey - sy + 1) / ROWNO)); - sbey = (ey * ((long) (ey - sy + 1) / ROWNO)); + if (sy > 0 || ey < (ROWNO - 1)) { + sbsy = (int) (((long) sy * (long) (ey - sy + 1)) / (long) ROWNO); + sbey = (int) (((long) ey * (long) (ey - sy + 1)) / (long) ROWNO); + + if (sy > 0 && sbsy == 0) + ++sbsy; + if (ey < ROWNO - 1 && sbey == ROWNO - 1) + --sbey; for (count = 0; count < sbsy; count++) { write_char(mapwin, ex - sx + 1 + bspace, count + bspace, vsb_back); From d0a32762abeca726b41bb10537988c22bc9e1aa0 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 25 Jun 2019 03:27:42 -0700 Subject: [PATCH 3/3] keyhelp typo --- dat/keyhelp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dat/keyhelp b/dat/keyhelp index d4df8d444..00a20955e 100644 --- a/dat/keyhelp +++ b/dat/keyhelp @@ -3,7 +3,7 @@ For example, ^S and ^Q are often used for XON/XOFF flow-control, meaning that ^S suspends output and subsequent ^Q resumes suspended - output. When that it the case, neither of those characters will + output. When that is the case, neither of those characters will reach NetHack when it is waiting for a command keystroke. So they aren't used as commands, but 'whatdoes' might not be able to tell you that if they don't get passed through to NetHack.