From 1c03d0970115c776d1c4791fea3c33f70b0b5378 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 18 Jun 2019 03:52:28 -0700 Subject: [PATCH] curses map window tty ignores map column #0 (0-based index), like the core, and draws the map in screen columns 1 (1-based index) through 79, leaving screen column 80 blank. curses was drawing all 80 map columns and since #0 was always unused, screen column 1 was blank and the map was shown in 2 through 80. Change curses to work like tty. This was too easy; there may be problems lurking. One known issue: it should be made smarter about when clipping/panning is necessary since it thinks that a full 80 columns are needed but 79 suffice. --- doc/fixes36.3 | 3 ++- win/curses/cursmisc.c | 2 ++ win/curses/curswins.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 1dc12edd1..23780792c 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.56 $ $NHDT-Date: 1560611967 2019/06/15 15:19:27 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.57 $ $NHDT-Date: 1560855142 2019/06/18 10:52:22 $ 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, @@ -128,6 +128,7 @@ curses: don't convert ^M (or or key) into ^J; both ^J and ^M commands, ^J means run toward bottom of screen (when number_pad is off) and ^M is not bound to any command, so accidental won't cause the hero to try to move +curses: draw map in screen columns 1..79 like tty, rather than in 2..80 curses+EDIT_GETLIN: when a prompt's answer was preloaded, using ESC to discard it deleted it from the answer buffer but didn't erase it from screen tty: re-do one optimization used when status conditions have all been removed diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 223a8be82..2991c61d7 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -519,6 +519,8 @@ 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 diff --git a/win/curses/curswins.c b/win/curses/curswins.c index 5c9997633..9599b4de8 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -363,10 +363,10 @@ curs_destroy_all_wins() void curses_putch(winid wid, int x, int y, int ch, int color, int attr) { + static boolean map_initted = FALSE; int sx, sy, ex, ey; boolean border = curses_window_has_border(wid); nethack_char nch; - static boolean map_initted = FALSE; /* if (wid == STATUS_WIN) { curses_update_stats(); @@ -381,6 +381,7 @@ curses_putch(winid wid, int x, int y, int ch, int color, int attr) map_initted = TRUE; } + --x; /* map column [0] is not used; draw column [1] in first screen col */ map[y][x].ch = ch; map[y][x].color = color; map[y][x].attr = attr; -- 2.40.0