fifo_pull() will put ERR to the buffer if read() will fail
for any reason. kgetch() will notice this ERR and won't
interpret any fifo contents setting peek = head. But when
_nc_wgetch() will handle SIGWINCH and KEY_RESIZE will be
pushed into fifo and taken out, ERR will still stay there.
We should take ERR from the fifo or kgetch() will return
ERR on all subsequent calls.
Signed-off-by: Eygene Ryabinkin <
rea-fbsd@...>
---
contrib/ncurses/ncurses/base/lib_getch.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c
index a3812be..e7ba0b2 100644
--- a/contrib/ncurses/ncurses/base/lib_getch.c
+++ b/contrib/ncurses/ncurses/base/lib_getch.c
@@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win,
/* resizeterm can push KEY_RESIZE */
if (cooked_key_in_fifo()) {
*result = fifo_pull(sp);
+ /*
+ * Get the ERR from queue -- it is from WINCH,
+ * so we should take it out, the "error" is handled.
+ */
+ if (fifo_peek(sp) == -1)
+ fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
}
--
1.6.4.4
--
Eygene
_ ___ _.--. #
\`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard
/ ' ` , __.--' # to read the on-line manual
)/' _/ \ `-_, / # while single-stepping the kernel.
`-'" `"\_ ,_.-;_.-\_ ', fsc/as #
_.-'_./ {_.' ; / # -- FreeBSD Developers handbook
{_.-``-' {_/ #
_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses