Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses Correct detecting of terminal resize in curses...
details: https://anonhg.NetBSD.org/src/rev/8c0e5aa3dcdf
branches: trunk
changeset: 993713:8c0e5aa3dcdf
user: kamil <kamil%NetBSD.org@localhost>
date: Wed Sep 26 14:42:22 2018 +0000
description:
Correct detecting of terminal resize in curses(3) with keypad(,TRUE)
A previous change fixed only keypad(,FALSE) scenarios.
Handle catching terminal resize in INKEY_NORM and INKEY_ASSEMBLING (in the
middle of assembling a key code from passed codes) as both accept keys with
fgetc(3) and both can be in theory interrupted with a resize.
PR lib/53615
diffstat:
lib/libcurses/get_wch.c | 16 ++++++++++++----
lib/libcurses/getch.c | 16 ++++++++++++----
2 files changed, 24 insertions(+), 8 deletions(-)
diffs (88 lines):
diff -r ca686cbbdf4e -r 8c0e5aa3dcdf lib/libcurses/get_wch.c
--- a/lib/libcurses/get_wch.c Wed Sep 26 12:59:37 2018 +0000
+++ b/lib/libcurses/get_wch.c Wed Sep 26 14:42:22 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: get_wch.c,v 1.15 2018/09/18 22:46:18 rin Exp $ */
+/* $NetBSD: get_wch.c,v 1.16 2018/09/26 14:42:22 kamil Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: get_wch.c,v 1.15 2018/09/18 22:46:18 rin Exp $");
+__RCSID("$NetBSD: get_wch.c,v 1.16 2018/09/26 14:42:22 kamil Exp $");
#endif /* not lint */
#include <errno.h>
@@ -103,7 +103,11 @@
c = fgetc(infd);
if (c == WEOF) {
clearerr(infd);
- return ERR;
+ if (errno == EINTR && _cursesi_screen->resized) {
+ _cursesi_screen->resized = 0;
+ return KEY_RESIZE;
+ } else
+ return ERR;
}
if (delay && (__notimeout() == ERR))
@@ -151,7 +155,11 @@
c = fgetc(infd);
if (ferror(infd)) {
clearerr(infd);
- return ERR;
+ if (errno == EINTR && _cursesi_screen->resized) {
+ _cursesi_screen->resized = 0;
+ return KEY_RESIZE;
+ } else
+ return ERR;
}
if ((to || delay) && (__notimeout() == ERR))
diff -r ca686cbbdf4e -r 8c0e5aa3dcdf lib/libcurses/getch.c
--- a/lib/libcurses/getch.c Wed Sep 26 12:59:37 2018 +0000
+++ b/lib/libcurses/getch.c Wed Sep 26 14:42:22 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getch.c,v 1.66 2018/09/18 22:46:18 rin Exp $ */
+/* $NetBSD: getch.c,v 1.67 2018/09/26 14:42:22 kamil Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getch.c 8.2 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: getch.c,v 1.66 2018/09/18 22:46:18 rin Exp $");
+__RCSID("$NetBSD: getch.c,v 1.67 2018/09/26 14:42:22 kamil Exp $");
#endif
#endif /* not lint */
@@ -563,7 +563,11 @@
c = fgetc(infd);
if (c == EOF) {
clearerr(infd);
- return ERR;
+ if (errno == EINTR && _cursesi_screen->resized) {
+ _cursesi_screen->resized = 0;
+ return KEY_RESIZE;
+ } else
+ return ERR;
}
if (delay && (__notimeout() == ERR))
@@ -605,7 +609,11 @@
c = fgetc(infd);
if (ferror(infd)) {
clearerr(infd);
- return ERR;
+ if (errno == EINTR && _cursesi_screen->resized) {
+ _cursesi_screen->resized = 0;
+ return KEY_RESIZE;
+ } else
+ return ERR;
}
if ((to || delay) && (__notimeout() == ERR))
Home |
Main Index |
Thread Index |
Old Index