X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_getch.c;h=0a04ef5a6e1bf1728b98a2a14aa52b625f704879;hp=575d112b81ad0764388ff9441ab17b688a44fa98;hb=f486c68b1efe3bab5739c3f464fde6685a52bee5;hpb=1385381954c39dc95558adc87fad457046959cc1 diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c index 575d112b..0a04ef5a 100644 --- a/ncurses/base/lib_getch.c +++ b/ncurses/base/lib_getch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: lib_getch.c,v 1.125 2012/08/04 17:11:37 tom Exp $") +MODULE_ID("$Id: lib_getch.c,v 1.126 2013/02/16 18:30:37 tom Exp $") #include @@ -439,11 +439,11 @@ _nc_wgetch(WINDOW *win, /* ungetch in reverse order */ #ifdef NCURSES_WGETCH_EVENTS rc = recur_wgetnstr(win, buf); - if (rc != KEY_EVENT) + if (rc != KEY_EVENT && rc != ERR) safe_ungetch(sp, '\n'); #else - (void) recur_wgetnstr(win, buf); - safe_ungetch(sp, '\n'); + if (recur_wgetnstr(win, buf) != ERR) + safe_ungetch(sp, '\n'); #endif for (bufp = buf + strlen(buf); bufp > buf; bufp--) safe_ungetch(sp, bufp[-1]);