-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.15 $ $NHDT-Date: 1558686805 2019/05/24 08:33:25 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.18 $ $NHDT-Date: 1558794988 2019/05/25 14:36:28 $
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,
messages rather than most recent N. [Still room for improvement;
when feasible it combines short lines, resulting in N messages on
fewer than N lines and leaving some of the available lines blank.]
+curses: plug memory leak when getting a line of input is cancelled by ESC
tty: re-do one optimization used when status conditions have all been removed
and remove another that tried to check whether condition text to be
displayed next was the same as the existing value; sometimes new
scroll_window(MESSAGE_WIN);
mx = width;
my--;
- strcpy(toplines, message);
+ Strcpy(toplines, message);
}
return;
}
char *tmpstr; /* for free() */
int maxy, maxx; /* linewrap / scroll */
int ch;
- WINDOW *win = curses_get_nhwin(MESSAGE_WIN);
int border_space = 0;
int len; /* of answer string */
boolean border = curses_window_has_border(MESSAGE_WIN);
+ WINDOW *win = curses_get_nhwin(MESSAGE_WIN);
orig_cursor = curs_set(0);
maxy = height - 1 + border_space;
maxx = width - 1 + border_space;
+ /* +2? buffer already includes room for terminator; +1: "prompt answer" */
tmpbuf = (char *) alloc((unsigned) ((int) strlen(prompt) + buffer + 2));
maxlines = buffer / width * 2;
Strcpy(tmpbuf, prompt);
/* if there isn't any input yet, return ESC */
if (len == 0) {
Strcpy(answer, "\033");
- return;
+ goto alldone;
}
/* otherwise, discard current input and start over;
first need to blank it from the screen */
break;
case ERR: /* should not happen */
*answer = '\0';
- free(tmpbuf);
- free(linestarts);
- curs_set(orig_cursor);
- curses_toggle_color_attr(win, NONE, A_BOLD, OFF);
- return;
+ goto alldone;
case '\r':
case '\n':
- free(linestarts);
(void) strncpy(answer, p_answer, buffer);
answer[buffer - 1] = '\0';
Strcpy(toplines, tmpbuf);
mesg_add_line(tmpbuf);
- free(tmpbuf);
- curs_set(orig_cursor);
- curses_toggle_color_attr(win, NONE, A_BOLD, OFF);
if (++my > maxy) {
scroll_window(MESSAGE_WIN);
my--;
}
mx = border_space;
- return;
+ goto alldone;
case '\177': /* DEL/Rubout */
case KEY_DC: /* delete-character */
case '\b': /* ^H (Backspace: '\011') */
p_answer[len] = '\0';
}
}
+
+ alldone:
+ free(linestarts);
+ free(tmpbuf);
+ curses_toggle_color_attr(win, NONE, A_BOLD, OFF);
+ curs_set(orig_cursor);
+ return;
}
/* Scroll lines upward in given window, or clear window if only one line. */