]> granicus.if.org Git - nethack/commitdiff
tty: ^C while prompted re-displays last message
authorcohrs <cohrs>
Mon, 4 Feb 2002 05:57:35 +0000 (05:57 +0000)
committercohrs <cohrs>
Mon, 4 Feb 2002 05:57:35 +0000 (05:57 +0000)
- attempt to determine if tty_wait_synch() is called during the ending
 dialogs due to an interrupt, and not re-display the previous message
 at the wrong time
- also, "msg_window display anomaly" fix was missing code to still treat ^P
 properly while in a prompt

win/tty/getline.c
win/tty/topl.c
win/tty/wintty.c

index 3bee369c3d6fae4fd476714c354310589bbb29eb..aa88d8a8d267a5eae94ee21e0ebabbd9695f1d1e 100644 (file)
@@ -73,7 +73,10 @@ getlin_hook_proc hook;
                }
                if(c == '\020') { /* ctrl-P */
                    if (iflags.prevmsg_window) {
+                       int sav = ttyDisplay->inread;
+                       ttyDisplay->inread = 0;
                        (void) tty_doprev_message();
+                       ttyDisplay->inread = sav;
                        tty_clear_nhwindow(WIN_MESSAGE);
                        cw->maxcol = cw->maxrow;
                        addtopl(query);
index 1d11d90be61b22eae788726240187765139cd9cf..aa793175675681e429ac5bebe0072c431fecf4ac 100644 (file)
@@ -300,12 +300,16 @@ char def;
            q = lowc(readchar());
            if (q == '\020') { /* ctrl-P */
                if (iflags.prevmsg_window) {
+                   int sav = ttyDisplay->inread;
+                   ttyDisplay->inread = 0;
                    (void) tty_doprev_message();
+                   ttyDisplay->inread = sav;
                    tty_clear_nhwindow(WIN_MESSAGE);
                    cw->maxcol = cw->maxrow;
                    addtopl(prompt);
                } else {
-                   if(!doprev) (void) tty_doprev_message(); /* need two initially */
+                   if(!doprev)
+                       (void) tty_doprev_message(); /* need two initially */
                    (void) tty_doprev_message();
                    doprev = 1;
                }
index 64e659dc669ef6b8b0d2c90f63c1da2e50da63a8..7d1f4cba420937933d990a0e3760b7a1b14aa0dc 100644 (file)
@@ -2218,7 +2218,7 @@ tty_wait_synch()
        if(ttyDisplay->inmore) {
            addtopl("--More--");
            (void) fflush(stdout);
-       } else if(ttyDisplay->inread) {
+       } else if(ttyDisplay->inread > program_state.gameover) {
            /* this can only happen if we were reading and got interrupted */
            ttyDisplay->toplin = 3;
            /* do this twice; 1st time gets the Quit? message again */