summaryrefslogtreecommitdiff
path: root/lib/libcurses/wresize.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-12-03 05:21:47 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-12-03 05:21:47 +0000
commit211326e37501ac01a66994a221020b75ab5f63f0 (patch)
tree6d6c7182f1034b1b04c98386a1c3ba44e8accd5f /lib/libcurses/wresize.c
parent7c742f381e7808d0b12c17b534305751f3ebb0cb (diff)
Merge of ncurses-4.1-971129
Diffstat (limited to 'lib/libcurses/wresize.c')
-rw-r--r--lib/libcurses/wresize.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/lib/libcurses/wresize.c b/lib/libcurses/wresize.c
index d50ef2f2a52..bdc423d00b6 100644
--- a/lib/libcurses/wresize.c
+++ b/lib/libcurses/wresize.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: wresize.c,v 1.3 1997/12/03 05:21:46 millert Exp $ */
+
/******************************************************************************
* Copyright 1996,1997 by Thomas E. Dickey <dickey@clark.net> *
* All Rights Reserved. *
@@ -21,7 +23,7 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("Id: wresize.c,v 1.5 1997/02/01 23:22:54 tom Exp $")
+MODULE_ID("Id: wresize.c,v 1.8 1997/09/20 15:03:39 juergen Exp $")
/*
* Reallocate a curses WINDOW struct to either shrink or grow to the specified
@@ -47,21 +49,24 @@ static void *doalloc(void *p, size_t n)
int
wresize(WINDOW *win, int ToLines, int ToCols)
{
- register int row;
- int size_x, size_y;
- struct ldat *pline = (win->_flags & _SUBWIN) ? win->_parent->_line : 0;
+ register int row;
+ int size_x, size_y;
+ struct ldat *pline;
+ chtype blank;
#ifdef TRACE
T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols));
- TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)",
- win->_begy, win->_begx,
- win->_maxy, win->_maxx,
- win->_regtop, win->_regbottom));
- if (_nc_tracing & TRACE_UPDATE)
- _tracedump("...before", win);
+ if (win) {
+ TR(TRACE_UPDATE, ("...beg (%d, %d), max(%d,%d), reg(%d,%d)",
+ win->_begy, win->_begx,
+ win->_maxy, win->_maxx,
+ win->_regtop, win->_regbottom));
+ if (_nc_tracing & TRACE_UPDATE)
+ _tracedump("...before", win);
+ }
#endif
- if (--ToLines < 0 || --ToCols < 0)
+ if (!win || --ToLines < 0 || --ToCols < 0)
returnCode(ERR);
size_x = win->_maxx;
@@ -71,6 +76,8 @@ wresize(WINDOW *win, int ToLines, int ToCols)
&& ToCols == size_x)
returnCode(OK);
+ pline = (win->_flags & _SUBWIN) ? win->_parent->_line : 0;
+
/*
* If the number of lines has changed, adjust the size of the overall
* vector:
@@ -99,13 +106,13 @@ wresize(WINDOW *win, int ToLines, int ToCols)
/*
* Adjust the width of the columns:
*/
+ blank = _nc_background(win);
for (row = 0; row <= ToLines; row++) {
chtype *s = win->_line[row].text;
int begin = (s == 0) ? 0 : size_x + 1;
int end = ToCols;
- chtype blank = _nc_background(win);
- win->_line[row].oldindex = row;
+ if_USE_SCROLL_HINTS(win->_line[row].oldindex = row);
if (ToCols != size_x || s == 0) {
if (! (win->_flags & _SUBWIN)) {