1 /* Copyright (c) 2008, 2009
2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4 * Micah Cowan (micah@cowan.name)
5 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
6 * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
7 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
8 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
9 * Copyright (c) 1987 Oliver Laumann
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3, or (at your option)
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program (see the file COPYING); if not, see
23 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 ****************************************************************
29 #include <sys/types.h>
32 #include <sys/ioctl.h>
37 # include <sys/sioctl.h>
45 static void CheckMaxSize
__P((int));
46 static void FreeMline
__P((struct mline
*));
47 static int AllocMline
__P((struct mline
*ml
, int));
48 static void MakeBlankLine
__P((unsigned char *, int));
49 static void kaablamm
__P((void));
50 static int BcopyMline
__P((struct mline
*, int, struct mline
*, int, int, int));
51 static void SwapAltScreen
__P((struct win
*));
53 extern struct layer
*flayer
;
54 extern struct display
*display
, *displays
;
55 extern unsigned char *blank
, *null
;
56 extern struct mline mline_blank
, mline_null
, mline_old
;
57 extern struct win
*windows
;
58 extern int Z0width
, Z1width
;
59 extern int captionalways
;
61 #if defined(TIOCGWINSZ) || defined(TIOCSWINSZ)
65 static struct mline mline_zero
= {
80 * ChangeFlag: 0: try to modify no window
81 * 1: modify fore (and try to modify no other) + redisplay
82 * 2: modify all windows
84 * Note: Activate() is only called if change_flag == 1
85 * i.e. on a WINCH event
89 CheckScreenSize(change_flag
)
96 debug("CheckScreenSize: No display -> no check.\n");
100 if (ioctl(D_userfd
, TIOCGWINSZ
, (char *)&glwz
) != 0)
102 debug2("CheckScreenSize: ioctl(%d, TIOCGWINSZ) errno %d\n", D_userfd
, errno
);
120 debug2("CheckScreenSize: screen is (%d,%d)\n", wi
, he
);
122 #if 0 /* XXX: Fixme */
123 if (change_flag
== 2)
125 debug("Trying to adapt all windows (-A)\n");
126 for (p
= windows
; p
; p
= p
->w_next
)
127 if (p
->w_display
== 0 || p
->w_display
== display
)
128 ChangeWindowSize(p
, wi
, he
, p
->w_histheight
);
131 if (D_width
== wi
&& D_height
== he
)
133 debug("CheckScreenSize: No change -> return.\n");
140 ChangeScreenSize(wi
, he
, change_flag
);
141 /* XXX Redisplay logic */
143 if (change_flag
== 1)
144 Redisplay(D_fore
? D_fore
->w_norefresh
: 0);
149 ChangeScreenSize(wi
, he
, change_fore
)
157 debug2("ChangeScreenSize from (%d,%d) ", D_width
, D_height
);
158 debug3("to (%d,%d) (change_fore: %d)\n",wi
, he
, change_fore
);
162 cv
->c_ye
= he
- 1 - ((cv
->c_slperp
&& cv
->c_slperp
->c_slnext
) || captionalways
) - (D_has_hstatus
== HSTATUS_LASTLINE
);
163 cv
->c_blank
.l_height
= cv
->c_ye
- cv
->c_ys
+ 1;
167 RecreateCanvasChain();
168 RethinkDisplayViewports();
173 D_fore
= Layer2Window(D_forecv
->c_layer
);
186 if (D_CZ0
&& (wi
== Z0width
|| wi
== Z1width
) &&
187 (D_CO
== Z0width
|| D_CO
== Z1width
))
193 debug2("Default size: (%d,%d)\n", D_defwidth
, D_defheight
);
195 ResizeLayersToCanvases();
196 if (change_fore
== 2 && D_CWS
== NULL
&& displays
->d_next
== 0)
198 /* adapt all windows - to be removed ? */
199 for (p
= windows
; p
; p
= p
->w_next
)
201 debug1("Trying to change window %d.\n", p
->w_number
);
204 if (D_CZ0
&& p
->w_width
!= wi
&& (wi
== Z0width
|| wi
== Z1width
))
206 if (p
->w_width
> (Z0width
+ Z1width
) / 2)
212 if (p
->w_savelayer
&& p
->w_savelayer
->l_cvlist
== 0)
213 ResizeLayer(p
->w_savelayer
, wwi
, he
, 0);
215 ChangeWindowSize(p
, wwi
, he
, p
->w_histheight
);
222 ResizeLayersToCanvases()
228 debug("ResizeLayersToCanvases\n");
230 for (cv
= D_cvlist
; cv
; cv
= cv
->c_next
)
235 debug("Doing canvas: ");
236 if (l
->l_width
== cv
->c_xe
- cv
->c_xs
+ 1 &&
237 l
->l_height
== cv
->c_ye
- cv
->c_ys
+ 1)
239 debug("already fitting.\n");
242 if (!MayResizeLayer(l
))
244 debug("may not resize.\n");
248 debug("doing resize.\n");
249 ResizeLayer(l
, cv
->c_xe
- cv
->c_xs
+ 1, cv
->c_ye
- cv
->c_ys
+ 1, display
);
252 /* normalize window, see screen.c */
253 lx
= cv
->c_layer
->l_x
;
254 ly
= cv
->c_layer
->l_y
;
255 if (ly
+ cv
->c_yoff
< cv
->c_ys
)
257 cv
->c_yoff
= cv
->c_ys
- ly
;
258 RethinkViewportOffsets(cv
);
260 else if (ly
+ cv
->c_yoff
> cv
->c_ye
)
262 cv
->c_yoff
= cv
->c_ye
- ly
;
263 RethinkViewportOffsets(cv
);
265 if (lx
+ cv
->c_xoff
< cv
->c_xs
)
267 int n
= cv
->c_xs
- (lx
+ cv
->c_xoff
);
268 if (n
< (cv
->c_xe
- cv
->c_xs
+ 1) / 2)
269 n
= (cv
->c_xe
- cv
->c_xs
+ 1) / 2;
270 if (cv
->c_xoff
+ n
> cv
->c_xs
)
271 n
= cv
->c_xs
- cv
->c_xoff
;
273 RethinkViewportOffsets(cv
);
275 else if (lx
+ cv
->c_xoff
> cv
->c_xe
)
277 int n
= lx
+ cv
->c_xoff
- cv
->c_xe
;
278 if (n
< (cv
->c_xe
- cv
->c_xs
+ 1) / 2)
279 n
= (cv
->c_xe
- cv
->c_xs
+ 1) / 2;
280 if (cv
->c_xoff
- n
+ cv
->c_layer
->l_width
- 1 < cv
->c_xe
)
281 n
= cv
->c_xoff
+ cv
->c_layer
->l_width
- 1 - cv
->c_xe
;
283 RethinkViewportOffsets(cv
);
299 debug("MayResizeLayer:\n");
300 for (; l
; l
= l
->l_next
)
303 if (++cvs
> 1 || l
->l_cvlist
->c_lnext
)
305 debug1("may not - cvs %d\n", cvs
);
309 debug("may resize\n");
314 * Easy implementation: rely on the fact that the only layers
315 * supporting resize are Win and Blank. So just kill all overlays.
317 * This is a lot harder if done the right way...
323 Msg(0, "Aborted because of window size change.");
326 /* Kills non-resizable layers. */
327 #define RESIZE_OR_KILL_LAYERS(l, wi, he) do \
329 struct layer *_last = NULL, *_iter; \
331 while (flayer->l_next) \
333 if (LayResize(wi, he) == 0) \
336 flayer = flayer->l_next; \
340 struct canvas *_cv; \
341 for (_cv = flayer->l_cvlist; _cv; _cv = _cv->c_lnext) \
342 _cv->c_display->d_kaablamm = 1; \
345 _last->l_next = flayer; \
348 /* We assume that the bottom-most layer, i.e. when flayer->l_next == 0, \
349 * is always resizable. Currently, WinLf and BlankLf can be the bottom-most layers. \
355 ResizeLayer(l
, wi
, he
, norefdisp
)
358 struct display
*norefdisp
;
362 struct layer
*oldflayer
= flayer
;
363 struct display
*d
, *olddisplay
= display
;
365 if (l
->l_width
== wi
&& l
->l_height
== he
)
369 /* If 'flayer' and 'l' are for the same window, then we will not
370 * restore 'flayer'. */
371 if (oldflayer
&& (l
== oldflayer
|| Layer2Window(oldflayer
) == p
))
378 /* It's a window layer. Kill the overlays on it in all displays. */
379 for (d
= displays
; d
; d
= d
->d_next
)
380 for (cv
= d
->d_cvlist
; cv
; cv
= cv
->c_next
)
382 if (p
== Layer2Window(cv
->c_layer
))
384 /* Canvas 'cv' on display 'd' shows this window. Remove any non-resizable
386 RESIZE_OR_KILL_LAYERS(cv
->c_layer
, wi
, he
);
392 /* It's a Blank layer. Just kill the non-resizable overlays over it. */
393 RESIZE_OR_KILL_LAYERS(flayer
, wi
, he
);
396 for (display
= displays
; display
; display
= display
->d_next
)
398 if (display
== norefdisp
)
400 for (cv
= D_cvlist
; cv
; cv
= cv
->c_next
)
401 if (Layer2Window(cv
->c_layer
) == p
)
403 CV_CALL(cv
, LayRedisplayLine(-1, -1, -1, 0));
404 RefreshArea(cv
->c_xs
, cv
->c_ys
, cv
->c_xe
, cv
->c_ye
, 0);
413 /* If we started resizing a non-flayer layer, then restore the flayer.
414 * Otherwise, flayer should already be updated to the topmost foreground layer. */
417 display
= olddisplay
;
426 if (ml
->attr
&& ml
->attr
!= null
)
429 if (ml
->font
&& ml
->font
!= null
)
433 if (ml
->color
&& ml
->color
!= null
)
436 if (ml
->colorx
&& ml
->colorx
!= null
)
448 ml
->image
= malloc(w
);
466 BcopyMline(mlf
, xf
, mlt
, xt
, l
, w
)
467 struct mline
*mlf
, *mlt
;
472 bcopy((char *)mlf
->image
+ xf
, (char *)mlt
->image
+ xt
, l
);
473 if (mlf
->attr
!= null
&& mlt
->attr
== null
)
475 if ((mlt
->attr
= (unsigned char *)calloc(w
, 1)) == 0)
476 mlt
->attr
= null
, r
= -1;
478 if (mlt
->attr
!= null
)
479 bcopy((char *)mlf
->attr
+ xf
, (char *)mlt
->attr
+ xt
, l
);
481 if (mlf
->font
!= null
&& mlt
->font
== null
)
483 if ((mlt
->font
= (unsigned char *)calloc(w
, 1)) == 0)
484 mlt
->font
= null
, r
= -1;
486 if (mlt
->font
!= null
)
487 bcopy((char *)mlf
->font
+ xf
, (char *)mlt
->font
+ xt
, l
);
490 if (mlf
->color
!= null
&& mlt
->color
== null
)
492 if ((mlt
->color
= (unsigned char *)calloc(w
, 1)) == 0)
493 mlt
->color
= null
, r
= -1;
495 if (mlt
->color
!= null
)
496 bcopy((char *)mlf
->color
+ xf
, (char *)mlt
->color
+ xt
, l
);
498 if (mlf
->colorx
!= null
&& mlt
->colorx
== null
)
500 if ((mlt
->colorx
= (unsigned char *)calloc(w
, 1)) == 0)
501 mlt
->colorx
= null
, r
= -1;
503 if (mlt
->colorx
!= null
)
504 bcopy((char *)mlf
->colorx
+ xf
, (char *)mlt
->colorx
+ xt
, l
);
517 unsigned char *oldnull
= null
;
518 unsigned char *oldblank
= blank
;
523 wi
= ((wi
+ 1) + 255) & ~255;
527 debug1("New maxwidth: %d\n", maxwidth
);
528 blank
= (unsigned char *)xrealloc((char *)blank
, maxwidth
);
529 null
= (unsigned char *)xrealloc((char *)null
, maxwidth
);
530 mline_old
.image
= (unsigned char *)xrealloc((char *)mline_old
.image
, maxwidth
);
531 mline_old
.attr
= (unsigned char *)xrealloc((char *)mline_old
.attr
, maxwidth
);
533 mline_old
.font
= (unsigned char *)xrealloc((char *)mline_old
.font
, maxwidth
);
536 mline_old
.color
= (unsigned char *)xrealloc((char *)mline_old
.color
, maxwidth
);
538 mline_old
.colorx
= (unsigned char *)xrealloc((char *)mline_old
.colorx
, maxwidth
);
541 if (!(blank
&& null
&& mline_old
.image
&& mline_old
.attr
IFFONT(&& mline_old
.font
) IFCOLOR(&& mline_old
.color
) IFCOLORX(&& mline_old
.colorx
)))
542 Panic(0, "%s", strnomem
);
544 MakeBlankLine(blank
, maxwidth
);
545 bzero((char *)null
, maxwidth
);
547 mline_blank
.image
= blank
;
548 mline_blank
.attr
= null
;
549 mline_null
.image
= null
;
550 mline_null
.attr
= null
;
552 mline_blank
.font
= null
;
553 mline_null
.font
= null
;
556 mline_blank
.color
= null
;
557 mline_null
.color
= null
;
559 mline_blank
.colorx
= null
;
560 mline_null
.colorx
= null
;
564 #define RESET_AFC(x, bl) do { if (x == old##bl) x = bl; } while (0)
566 #define RESET_LINES(lines, count) \
569 for (i = 0; i < count; i++, ml++) \
571 RESET_AFC(ml->image, blank); \
572 RESET_AFC(ml->attr, null); \
573 IFFONT(RESET_AFC(ml->font, null)); \
574 IFCOLOR(RESET_AFC(ml->color, null)); \
575 IFCOLORX(RESET_AFC(ml->colorx, null)); \
579 /* We have to run through all windows to substitute
580 * the null and blank references.
582 for (p
= windows
; p
; p
= p
->w_next
)
584 RESET_LINES(p
->w_mlines
, p
->w_height
);
587 RESET_LINES(p
->w_hlines
, p
->w_histheight
);
588 RESET_LINES(p
->w_alt
.hlines
, p
->w_alt
.histheight
);
591 RESET_LINES(p
->w_alt
.mlines
, p
->w_alt
.height
);
605 if ((nmem
= realloc(mem
, len
)))
613 register unsigned char *p
;
625 #define OLDWIN(y) ((y < p->w_histheight) \
626 ? &p->w_hlines[(p->w_histidx + y) % p->w_histheight] \
627 : &p->w_mlines[y - p->w_histheight])
629 #define NEWWIN(y) ((y < hi) ? &nhlines[y] : &nmlines[y - hi])
633 #define OLDWIN(y) (&p->w_mlines[y])
634 #define NEWWIN(y) (&nmlines[y])
640 ChangeWindowSize(p
, wi
, he
, hi
)
644 struct mline
*mlf
= 0, *mlt
= 0, *ml
, *nmlines
, *nhlines
;
645 int fy
, ty
, l
, lx
, lf
, lt
, yy
, oty
, addone
;
646 int ncx
, ncy
, naka
, t
;
649 if (wi
<= 0 || he
<= 0)
652 if (p
->w_type
== W_TYPE_GROUP
)
657 Msg(0, "Window width too large. Truncated to 1000.");
663 Msg(0, "Window height too large. Truncated to 1000.");
667 if (p
->w_width
== wi
&& p
->w_height
== he
&& p
->w_histheight
== hi
)
669 debug("ChangeWindowSize: No change.\n");
677 /* just in case ... */
678 if (wi
&& (p
->w_width
!= wi
|| p
->w_height
!= he
) && p
->w_lay
!= &p
->w_winlay
)
680 debug("ChangeWindowSize: No resize because of overlay?\n");
685 debug("ChangeWindowSize");
686 debug3(" from (%d,%d)+%d", p
->w_width
, p
->w_height
, p
->w_histheight
);
687 debug3(" to(%d,%d)+%d\n", wi
, he
, hi
);
689 fy
= p
->w_histheight
+ p
->w_height
- 1;
692 nmlines
= nhlines
= 0;
699 if (wi
!= p
->w_width
|| he
!= p
->w_height
)
701 if ((nmlines
= (struct mline
*)calloc(he
, sizeof(struct mline
))) == 0)
704 Msg(0, "%s", strnomem
);
710 debug1("image stays the same: %d lines\n", he
);
711 nmlines
= p
->w_mlines
;
722 if ((nhlines
= (struct mline
*)calloc(hi
, sizeof(struct mline
))) == 0)
724 Msg(0, "No memory for history buffer - turned off");
731 /* special case: cursor is at magic margin position */
733 if (p
->w_width
&& p
->w_x
== p
->w_width
)
735 debug2("Special addone case: %d %d\n", p
->w_x
, p
->w_y
);
740 /* handle the cursor and autoaka lines now if the widths are equal */
741 if (p
->w_width
== wi
)
743 ncx
= p
->w_x
+ addone
;
744 ncy
= p
->w_y
+ he
- p
->w_height
;
745 /* never lose sight of the line with the cursor on it */
747 for (yy
= p
->w_y
+ p
->w_histheight
- 1; yy
>= 0 && ncy
+ shift
< he
; yy
--)
750 if (ml
->image
[p
->w_width
] == ' ')
757 debug1("resize: cursor out of bounds, shifting %d\n", shift
);
759 if (p
->w_autoaka
> 0)
761 naka
= p
->w_autoaka
+ he
- p
->w_height
+ shift
;
762 if (naka
< 1 || naka
> he
)
772 debug2("fy %d ty %d\n", fy
, ty
);
778 while (fy
>= 0 && ty
>= 0)
780 if (p
->w_width
== wi
)
782 /* here is a simple shortcut: just copy over */
792 /* calculate lenght */
793 for (l
= p
->w_width
- 1; l
> 0; l
--)
794 if (mlf
->image
[l
] != ' ' || mlf
->attr
[l
])
796 if (fy
== p
->w_y
+ p
->w_histheight
&& l
< p
->w_x
)
797 l
= p
->w_x
; /* cursor is non blank */
801 /* add wrapped lines to length */
802 for (yy
= fy
- 1; yy
>= 0; yy
--)
805 if (ml
->image
[p
->w_width
] == ' ')
811 lt
= (l
- 1) % wi
+ 1; /* lf is set above */
813 while (l
> 0 && fy
>= 0 && ty
>= 0)
815 lx
= lt
> lf
? lf
: lt
;
818 if (AllocMline(mlt
, wi
+ 1))
820 MakeBlankLine(mlt
->image
+ lt
, wi
- lt
);
821 mlt
->image
[wi
] = ((oty
== ty
) ? ' ' : 0);
823 if (BcopyMline(mlf
, lf
- lx
, mlt
, lt
- lx
, lx
, wi
+ 1))
826 /* did we copy the cursor ? */
827 if (fy
== p
->w_y
+ p
->w_histheight
&& lf
- lx
<= p
->w_x
&& lf
> p
->w_x
)
829 ncx
= p
->w_x
+ lt
- lf
+ addone
;
831 shift
= wi
? -ncy
+ (l
- lx
) / wi
: 0;
832 if (ty
+ shift
> hi
+ he
- 1)
833 shift
= hi
+ he
- 1 - ty
;
836 debug3("resize: cursor out of bounds, shifting %d [%d/%d]\n", shift
, lt
- lx
, wi
);
837 for (y
= hi
+ he
- 1; y
>= ty
; y
--)
843 ml
= NEWWIN(y
- shift
);
851 naka
= naka
+ shift
> he
? 0 : naka
+ shift
;
855 /* did we copy autoaka line ? */
856 if (p
->w_autoaka
> 0 && fy
== p
->w_autoaka
- 1 + p
->w_histheight
&& lf
- lx
<= 0)
857 naka
= ty
- hi
>= 0 ? 1 + ty
- hi
: 0;
876 ASSERT(l
!= 0 || fy
== yy
);
886 if (AllocMline(mlt
, wi
+ 1))
888 MakeBlankLine(mlt
->image
, wi
+ 1);
894 if (nmlines
!= p
->w_mlines
)
895 for (fy
= 0; fy
< p
->w_height
+ p
->w_histheight
; fy
++)
898 ASSERT(ml
->image
== 0);
902 if (p
->w_mlines
&& p
->w_mlines
!= nmlines
)
903 free((char *)p
->w_mlines
);
904 p
->w_mlines
= nmlines
;
906 if (p
->w_hlines
&& p
->w_hlines
!= nhlines
)
907 free((char *)p
->w_hlines
);
908 p
->w_hlines
= nhlines
;
910 nmlines
= nhlines
= 0;
913 if (p
->w_width
!= wi
)
917 t
= p
->w_tabs
? p
->w_width
: 0;
918 p
->w_tabs
= xrealloc(p
->w_tabs
, wi
+ 1);
924 for (ty
= he
+ hi
- 1; ty
>= 0; ty
--)
929 if (nmlines
&& p
->w_mlines
!= nmlines
)
930 free((char *)nmlines
);
932 if (nhlines
&& p
->w_hlines
!= nhlines
)
933 free((char *)nhlines
);
937 Msg(0, "%s", strnomem
);
941 p
->w_tabs
[t
] = t
&& !(t
& 7) ? 1 : 0;
952 /* Change w_saved.y - this is only an estimate... */
953 p
->w_saved
.y
+= ncy
- p
->w_y
;
957 if (p
->w_autoaka
> 0)
960 /* do sanity checks */
965 if (p
->w_saved
.x
> wi
)
967 if (p
->w_saved
.y
< 0)
969 if (p
->w_saved
.y
>= he
)
970 p
->w_saved
.y
= he
- 1;
971 if (p
->w_alt
.cursor
.x
> wi
)
972 p
->w_alt
.cursor
.x
= wi
;
973 if (p
->w_alt
.cursor
.y
>= he
)
974 p
->w_alt
.cursor
.y
= he
- 1;
976 /* reset scrolling region */
980 /* signal new size to window */
982 if (wi
&& (p
->w_width
!= wi
|| p
->w_height
!= he
)
983 && p
->w_width
!= 0 && p
->w_height
!= 0 && p
->w_ptyfd
>= 0 && p
->w_pid
)
987 debug("Setting pty winsize.\n");
988 if (ioctl(p
->w_ptyfd
, TIOCSWINSZ
, (char *)&glwz
))
989 debug2("SetPtySize: errno %d (fd:%d)\n", errno
, p
->w_ptyfd
);
991 #endif /* TIOCSWINSZ */
998 p
->w_histheight
= hi
;
1001 #ifdef BUILTIN_TELNET
1002 if (p
->w_type
== W_TYPE_TELNET
)
1007 /* Test if everything was ok */
1008 for (fy
= 0; fy
< p
->w_height
+ p
->w_histheight
; fy
++)
1013 if (p
->w_encoding
== UTF8
)
1015 for (l
= 0; l
< p
->w_width
; l
++)
1016 ASSERT(ml
->image
[l
] >= ' ' || ml
->font
[l
]);
1020 for (l
= 0; l
< p
->w_width
; l
++)
1021 ASSERT(ml
->image
[l
] >= ' ');
1033 if (p
->w_alt
.mlines
)
1035 for (i
= 0; i
< p
->w_alt
.height
; i
++)
1036 FreeMline(p
->w_alt
.mlines
+ i
);
1037 free(p
->w_alt
.mlines
);
1039 p
->w_alt
.mlines
= 0;
1041 p
->w_alt
.height
= 0;
1043 if (p
->w_alt
.hlines
)
1045 for (i
= 0; i
< p
->w_alt
.histheight
; i
++)
1046 FreeMline(p
->w_alt
.hlines
+ i
);
1047 free(p
->w_alt
.hlines
);
1049 p
->w_alt
.hlines
= 0;
1050 p
->w_alt
.histidx
= 0;
1051 p
->w_alt
.histheight
= 0;
1062 #define SWAP(item, t) do { (t) = p->w_alt. item; p->w_alt. item = p->w_##item; p->w_##item = (t); } while (0)
1069 SWAP(histheight
, t
);
1082 /* If not already using the alternate screen buffer, then create
1083 a new one and swap it with the 'real' screen buffer. */
1089 /* Already using the alternate buffer. Just clear the screen. To do so, it
1090 is only necessary to reset the height(s) without resetting the width. */
1092 p
->w_histheight
= 0;
1094 ChangeWindowSize(p
, p
->w_alt
.width
, p
->w_alt
.height
, p
->w_alt
.histheight
);
1105 ChangeWindowSize(p
, p
->w_alt
.width
, p
->w_alt
.height
, p
->w_alt
.histheight
);