]> granicus.if.org Git - nethack/commitdiff
regression in process_text_window()
authornhmall <nhmall@nethack.org>
Mon, 9 May 2022 00:27:00 +0000 (20:27 -0400)
committernhmall <nhmall@nethack.org>
Mon, 9 May 2022 00:27:00 +0000 (20:27 -0400)
original code:

     if (linestart && (*cp & 0x80) != 0) {
         g_putch(*cp);
         end_glyphout();
         linestart = FALSE;
     } else {
         (void) putchar(*cp);
     }

new code:

    if (linestart) {
        if (SYMHANDLING(H_UTF8)) {
            /* FIXME: what is actually in that line? is it the \GNNNNNNNN or UTF-8? */
            g_putch(*cp);
        } else if ((*cp & 0x80) != 0) {
            g_putch(*cp);
            end_glyphout();
        }
        linestart = FALSE;
    } else {
        (void) putchar(*cp);
    }

The new code didn't output a character if linestart was true and the character did
not have bit 0x80 set.

fixed code:

    if (linestart) {
        if (SYMHANDLING(H_UTF8)) {
            /* FIXME: what is actually in that line? is it the \GNNNNNNNN or UTF-8? */
            g_putch(*cp);
        } else if ((*cp & 0x80) != 0) {
            g_putch(*cp);
            end_glyphout();
        } else {
            (void) putchar(*cp);
        }
        linestart = FALSE;
    } else {
        (void) putchar(*cp);
    }

win/tty/wintty.c

index f3d10a9626971a585ae0e8cb39a6f307cfa5b8ec..f2c36bf5cfb0ec7f04cc85d98b4690519020fead 100644 (file)
@@ -2368,6 +2368,8 @@ process_text_window(winid window, struct WinDesc *cw)
                     } else if ((*cp & 0x80) != 0) {
                         g_putch(*cp);
                         end_glyphout();
+                    } else {
+                        (void) putchar(*cp);
                     }
                     linestart = FALSE;
                 } else {