When resizing terminal smaller, destroy some split windows if they don't fit

into screen otherwise. Also, irssi doesn't crash anymore or mess up the
screen even if terminal is resized to 1x1 size (not sure of 0x0, my terminal
doesn't resize that small, and maybe I shouldn't bother with it anyway :)


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1855 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-10-20 10:35:42 +00:00 committed by cras
commit 69dccf4a67
3 changed files with 35 additions and 46 deletions

View file

@ -282,8 +282,15 @@ void screen_window_clear(SCREEN_WINDOW *window)
void screen_window_move(SCREEN_WINDOW *window, int x, int y,
int width, int height)
{
/* some checks to make sure the window is visible in screen,
otherwise curses could get nasty and not show our window anymore. */
if (width < 1) width = 1;
if (height < 1) height = 1;
if (x+width > screen_width) x = screen_width-width;
if (y+height > screen_height) y = screen_height-height;
#ifdef HAVE_CURSES_WRESIZE
if (window->width != width || window->height != height)
if (window->width != width || window->height != height)
wresize(window->win, height, width);
if (window->x != x || window->y != y)
mvwin(window->win, y, x);