]> granicus.if.org Git - nethack/commitdiff
stale prompt revisited
authornethack.rankin <nethack.rankin>
Thu, 12 May 2005 03:16:05 +0000 (03:16 +0000)
committernethack.rankin <nethack.rankin>
Thu, 12 May 2005 03:16:05 +0000 (03:16 +0000)
     Further discussion in the newsgroup pointed out a case not involving
<ESC> where the "In what direction?" prompt remained displayed after it was
no longer applicable:  throwing something where there's no monster target
in the line of fire.  You don't get any hit or miss message in a case like
that, so the last message (the prompt) stays in view.  I don't think there
are any cases where getdir()'s caller deliberately wants to leave the old
prompt up, so just clear it unconditionally as soon as the user answers.

src/cmd.c

index de8ee99982fc1ee23d3f532a82250ee44f9e09d7..abdd0a5d70908748219f7a5240cbc7f2bdc45591 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -2178,6 +2178,8 @@ const char *s;
 #endif
            dirsym = yn_function((s && *s != '^') ? s : "In what direction?",
                                        (char *)0, '\0');
+       /* remove the prompt string so caller won't have to */
+       clear_nhwindow(WIN_MESSAGE);
 
        if (redraw_cmd(dirsym)) {               /* ^R */
            docrt();            /* redraw */
@@ -2192,10 +2194,7 @@ const char *s;
        } else if (!movecmd(dirsym) && !u.dz) {
            boolean did_help = FALSE, help_requested;
 
-           if (index(quitchars, dirsym)) {
-               /* remove the prompt string */
-               clear_nhwindow(WIN_MESSAGE);
-           } else {
+           if (!index(quitchars, dirsym)) {
                help_requested = (dirsym == '?');
                if (help_requested || iflags.cmdassist) {
                    did_help = help_dir((s && *s == '^') ? dirsym : 0,