Commit Diff


commit - e5a2797faaeff6b9a4012a166ab9caa6c3634a5d
commit + 23f22c831d0a8e842699264fa1228a779f097e26
blob - c976d386465eb4267bed7caa84ca7f6c1671f0a1
blob + 29ec159ec7a00421fbf45ab9a858446a21de27fc
--- ui.c
+++ ui.c
@@ -74,6 +74,7 @@ static void		 recompute_help(void);
 static void		 update_loading_anim(int, short, void*);
 static void		 stop_loading_anim(struct tab*);
 
+static int		 too_small;
 static int		 x_offset;
 
 struct thiskey thiskey;
@@ -239,6 +240,10 @@ dispatch_stdio(int fd, short ev, void *d)
 	const char	*keyname;
 	char		 tmp[5] = {0};
 
+	/* TODO: schedule a redraw? */
+	if (too_small)
+		return;
+
 	if (!readkey())
 		return;
 
@@ -319,6 +324,13 @@ handle_resize_nodelay(int s, short ev, void *d)
 
 	lines = LINES;
 
+	if ((too_small = lines < 15)) {
+		erase();
+		printw("Window too small.");
+		refresh();
+		return;
+	}
+
 	/* move and resize the windows, in reverse order! */
 
 	mvwin(echoarea, --lines, 0);
@@ -845,6 +857,9 @@ place_cursor(int soft)
 static void
 redraw_tab(struct tab *tab)
 {
+	if (too_small)
+		return;
+
 	if (side_window) {
 		redraw_help();
 		wnoutrefresh(help);