]> granicus.if.org Git - nethack/commitdiff
TTY: Guard against impossible x coord
authorPasi Kallinen <paxed@alt.org>
Fri, 27 Mar 2015 13:29:54 +0000 (15:29 +0200)
committerPasi Kallinen <paxed@alt.org>
Fri, 27 Mar 2015 13:29:54 +0000 (15:29 +0200)
If a menu item was longer than terminal width, the menu wasn't
cleared away after it was finished with.  This easily happened
when an inventory item was named.

win/tty/wintty.c

index 5535537448e9c58d60331fc12056ff94a72cd981..f3cc97eb542e1f2209b1b428ea99e00dda0f076a 100644 (file)
@@ -1809,6 +1809,7 @@ tty_display_nhwindow(window, blocking)
        cw->offx = (uchar) (int)
            max((int) 10, (int) (ttyDisplay->cols - cw->maxcol - 1));
 #endif
+       if(cw->offx < 0) cw->offx = 0;
        if(cw->type == NHW_MENU)
            cw->offy = 0;
        if(ttyDisplay->toplin == 1)