curses+EDIT_GETLIN again

Turns the "fix" in commit 319dcf4746
handled removing the default answer for single-line-prompt plus
multi-line-answer but not for multi-line-prompt plus long-enough-
answer-to-reach-another-line.  The logic wasn't quite right and I
misunderstood what is stored in linestarts[] so even correct logic
wouldn't have solved things.
This commit is contained in:
PatR
2019-06-28 17:00:20 -07:00
committed by Pasi Kallinen
parent be94808d67
commit de44286d79
2 changed files with 11 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.77 $ $NHDT-Date: 1561751390 2019/06/28 19:49:50 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.78 $ $NHDT-Date: 1561766416 2019/06/29 00:00:16 $
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,
@@ -177,6 +177,9 @@ curses+'popup_dialog': show the text cursor at the end of prompts for single
character input
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
curses+EDIT_GETLIN: the preceding fix handled an answer which spanned more
than one line but didn't remove the answer properly if the prompt
portion of prompt+answer spanned more than one line
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

View File

@@ -550,12 +550,13 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer)
if that is called for; find where the end of the prompt will
be without the answer appended */
while (ltmp2 > 0) {
ltmp2 -= ltmp;
if ((ltmp2 -= ltmp) < 0) {
ltmp = -ltmp2;
break;
}
promptline -= 1;
ltmp = (int) strlen(linestarts[promptline]);
ltmp = linestarts[promptline + 1] - linestarts[promptline];
}
if (ltmp2 < 0)
ltmp = -ltmp2;
promptx = ltmp + border_space;
}
#endif
@@ -597,11 +598,11 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer)
#endif
curs_set(0);
if (erase_char && ch == erase_char) {
if (erase_char && ch == (int) (uchar) erase_char) {
ch = '\177'; /* match switch-case below */
/* honor kill_char if it's ^U or similar, but not if it's '@' */
} else if (kill_char && ch == kill_char
} else if (kill_char && ch == (int) (uchar) kill_char
&& (ch < ' ' || ch >= '\177')) { /*ASCII*/
if (len == 0) /* nothing to kill; just start over */
continue;