$OpenBSD: patch-src_screen_c,v 1.6 2014/09/02 08:44:16 dcoppa Exp $
--- src/screen.c.orig	Mon Jul 14 11:41:28 2014
+++ src/screen.c	Tue Sep  2 10:37:05 2014
@@ -41,6 +41,8 @@
 #include "screen_outputs.h"
 #include "screen_chat.h"
 
+#include <sys/ioctl.h>
+
 #include <mpd/client.h>
 
 #include <stdlib.h>
@@ -48,6 +50,7 @@
 #include <string.h>
 #include <time.h>
 #include <locale.h>
+#include <termios.h>
 
 #ifndef NCMPC_MINI
 /** welcome message time [s] */
@@ -199,6 +202,13 @@ screen_exit(void)
 void
 screen_resize(struct mpdclient *c)
 {
+	struct winsize ws;
+
+	if (ioctl(fileno(stdout), TIOCGWINSZ, &ws) == 0) {
+		LINES = ws.ws_row;
+		COLS = ws.ws_col;
+	}
+
 	if (COLS<SCREEN_MIN_COLS || LINES<SCREEN_MIN_ROWS) {
 		screen_exit();
 		fprintf(stderr, "%s\n", _("Error: Screen too small"));
