diff options
Diffstat (limited to 'contrib/ncurses/ncurses/base/wresize.c')
-rw-r--r-- | contrib/ncurses/ncurses/base/wresize.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/contrib/ncurses/ncurses/base/wresize.c b/contrib/ncurses/ncurses/base/wresize.c index 4889ee0..fa97a2b 100644 --- a/contrib/ncurses/ncurses/base/wresize.c +++ b/contrib/ncurses/ncurses/base/wresize.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include <curses.priv.h> -MODULE_ID("$Id: wresize.c,v 1.18 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: wresize.c,v 1.21 2002/05/11 19:36:29 tom Exp $") /* * Reallocate a curses WINDOW struct to either shrink or grow to the specified @@ -42,7 +42,7 @@ MODULE_ID("$Id: wresize.c,v 1.18 2000/12/10 02:43:28 tom Exp $") #define DOALLOC(p,t,n) typeRealloc(t, n, p) #define ld_ALLOC(p,n) DOALLOC(p,struct ldat,n) -#define c_ALLOC(p,n) DOALLOC(p,chtype,n) +#define c_ALLOC(p,n) DOALLOC(p,NCURSES_CH_T,n) NCURSES_EXPORT(int) wresize(WINDOW *win, int ToLines, int ToCols) @@ -50,7 +50,7 @@ wresize(WINDOW *win, int ToLines, int ToCols) register int row; int size_x, size_y; struct ldat *pline; - chtype blank; + NCURSES_CH_T blank; #ifdef TRACE T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols)); @@ -117,9 +117,9 @@ wresize(WINDOW *win, int ToLines, int ToCols) /* * Adjust the width of the columns: */ - blank = _nc_background(win); + blank = win->_nc_bkgd; for (row = 0; row <= ToLines; row++) { - chtype *s = win->_line[row].text; + NCURSES_CH_T *s = win->_line[row].text; int begin = (s == 0) ? 0 : size_x + 1; int end = ToCols; @@ -130,7 +130,7 @@ wresize(WINDOW *win, int ToLines, int ToCols) win->_line[row].text = s = c_ALLOC(s, ToCols + 1); if (win->_line[row].text == 0) returnCode(ERR); - } else if (s == 0) { + } else { win->_line[row].text = s = &pline[win->_pary + row].text[win->_parx]; } @@ -138,14 +138,15 @@ wresize(WINDOW *win, int ToLines, int ToCols) if (end >= begin) { /* growing */ if (win->_line[row].firstchar < begin) win->_line[row].firstchar = begin; - win->_line[row].lastchar = ToCols; - do { - s[end] = blank; - } while (--end >= begin); + if (!(win->_flags & _SUBWIN)) { + do { + s[end] = blank; + } while (--end >= begin); + } } else { /* shrinking */ win->_line[row].firstchar = 0; - win->_line[row].lastchar = ToCols; } + win->_line[row].lastchar = ToCols; } } |