Port the bounded KEY_RESIZE drain from the mtr085 fork so repeated terminal resize events do not keep curses input stuck on resize notifications.
Ported-from: yvs2014/mtr085@
249b8e97db05f4deb80c8df44cebb71f6424ec54
Original-author: yvs <VSYakovetsky@gmail.com>
float f = 0.0;
char buf[MAXFLD + 1];
+#ifdef KEY_RESIZE
+ /*
+ Some curses implementations may queue many resize events while the
+ terminal is being dragged. Drain a bounded batch so real key input
+ can be handled again after the resize settles.
+ */
+ if (c == KEY_RESIZE) {
+ int resize_events;
+
+ for (resize_events = 0; resize_events < 100 && c == KEY_RESIZE;
+ resize_events++) {
+ c = getch();
+ }
+ if (c == KEY_RESIZE) {
+ flushinp();
+ }
+ }
+#endif
+
if (c == 'Q') { /* must be checked before c = tolower(c) */
mvprintw(2, 0, "Type of Service(tos): %d\n", ctl->tos);
mvprintw(3, 0,