summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-01-14 02:44:57 +0000
committerguenther <guenther@openbsd.org>2014-01-14 02:44:57 +0000
commit6def4870fc000b3f92457ea7b2ce64a839cfae17 (patch)
tree1b63ec746ad31052e905c29cbb0e9126f70a28c8
parentAdd a new option "-fstack-protector-strong" for GCC4. This includes (diff)
downloadwireguard-openbsd-6def4870fc000b3f92457ea7b2ce64a839cfae17.tar.xz
wireguard-openbsd-6def4870fc000b3f92457ea7b2ce64a839cfae17.zip
getnstr() returns KEY_RESIZE if there was a pending resize event, so loop
until it stops returning that, resetting the cursor position each time. hint from Gregor Best (gbe (at) ring0.de) problem noted by and ok sthen@
-rw-r--r--usr.bin/top/display.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c
index d91dc266077..05e62ed55c3 100644
--- a/usr.bin/top/display.c
+++ b/usr.bin/top/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.46 2013/11/28 18:24:55 deraadt Exp $ */
+/* $OpenBSD: display.c,v 1.47 2014/01/14 02:44:57 guenther Exp $ */
/*
* Top users/processes display for Unix
@@ -641,9 +641,12 @@ readline(char *buffer, int size)
/* allow room for null terminator */
size -= 1;
- if (smart_terminal)
- getnstr(buffer, size);
- else
+ if (smart_terminal) {
+ int y, x;
+ getyx(stdscr, y, x);
+ while (getnstr(buffer, size) == KEY_RESIZE)
+ move(y, x);
+ } else
return readlinedumb(buffer, size);
cnt = strlen(buffer);