diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 304f16b59..e15c6b746 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.48 $ $NHDT-Date: 1560085861 2019/06/09 13:11:01 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.49 $ $NHDT-Date: 1560089250 2019/06/09 14:07:30 $ 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, @@ -109,6 +109,8 @@ 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+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 and remove another that tried to check whether condition text to be displayed next was the same as the existing value; sometimes new diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 503a58855..4cf81e4f6 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -469,7 +469,7 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer) int maxy, maxx; /* linewrap / scroll */ int ch; int border_space = 0; - int len; /* of answer string */ + int ltmp, len; /* of answer string */ boolean border = curses_window_has_border(MESSAGE_WIN); WINDOW *win = curses_get_nhwin(MESSAGE_WIN); @@ -531,9 +531,30 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer) my--; } } - mvwaddstr(win, my, mx, linestarts[nlines - 1]); - mx = promptx = (int) strlen(linestarts[nlines - 1]) + border_space; promptline = nlines - 1; + mvwaddstr(win, my, mx, linestarts[promptline]); + ltmp = (int) strlen(linestarts[promptline]); + mx = promptx = ltmp + border_space; +#ifdef EDIT_GETLIN + if (len <= ltmp) { + /* preloaded answer fits on same line as [last line of] prompt */ + promptx -= len; + } else { + int ltmp2 = len; + + /* preloaded answer spans lines so will be trickier to erase + if that is called for; find where the end of the prompt will + be without the answer appended */ + while (ltmp2 > 0) { + ltmp2 -= ltmp; + promptline -= 1; + ltmp = (int) strlen(linestarts[promptline]); + } + if (ltmp2 < 0) + ltmp = -ltmp2; + promptx = ltmp + border_space; + } +#endif while (1) { mx = (int) strlen(linestarts[nlines - 1]) + border_space;