--- ansi.c.O Fri Dec 5 05:57:05 2003 +++ ansi.c Mon Jan 16 06:08:39 2006 @@ -1390,12 +1390,9 @@ case 47: /* xterm-like alternate screen */ case 1047: /* xterm-like alternate screen */ case 1049: /* xterm-like alternate screen */ - if (use_altscreen) + if (use_altscreen && i != curr->w_alt_buf ) { - if (i) - EnterAltScreen(curr); - else - LeaveAltScreen(curr); + SwapAltScreen(curr, i); if (a1 == 47 && !i) curr->w_saved = 0; LRefreshAll(&curr->w_layer, 0); --- extern.h.O Fri Aug 22 05:27:57 2003 +++ extern.h Mon Jan 16 06:06:05 2006 @@ -316,9 +316,7 @@ extern void ResizeLayersToCanvases __P((void)); extern void ResizeLayer __P((struct layer *, int, int, struct display *)); extern int MayResizeLayer __P((struct layer *)); -extern void FreeAltScreen __P((struct win *)); -extern void EnterAltScreen __P((struct win *)); -extern void LeaveAltScreen __P((struct win *)); +extern void SwapAltScreen __P((struct win *, int)); /* sched.c */ extern void evenq __P((struct event *)); --- resize.c.O Mon Sep 8 07:26:31 2003 +++ resize.c Mon Jan 16 06:10:51 2006 @@ -43,7 +43,6 @@ static void MakeBlankLine __P((unsigned char *, int)); static void kaablamm __P((void)); static int BcopyMline __P((struct mline *, int, struct mline *, int, int, int)); -static void SwapAltScreen __P((struct win *)); extern struct layer *flayer; extern struct display *display, *displays; @@ -1038,36 +1037,14 @@ } void -FreeAltScreen(p) -struct win *p; -{ - int i; - - if (p->w_alt_mlines) - for (i = 0; i < p->w_alt_height; i++) - FreeMline(p->w_alt_mlines + i); - p->w_alt_mlines = 0; - p->w_alt_width = 0; - p->w_alt_height = 0; - p->w_alt_x = 0; - p->w_alt_y = 0; -#ifdef COPY_PASTE - if (p->w_alt_hlines) - for (i = 0; i < p->w_alt_histheight; i++) - FreeMline(p->w_alt_hlines + i); - p->w_alt_hlines = 0; - p->w_alt_histidx = 0; -#endif - p->w_alt_histheight = 0; -} - -static void -SwapAltScreen(p) +SwapAltScreen(p, alt) struct win *p; +int alt; { struct mline *ml; int t; + p->w_alt_buf = alt; ml = p->w_alt_mlines; p->w_alt_mlines = p->w_mlines; p->w_mlines = ml; t = p->w_alt_width; p->w_alt_width = p->w_width; p->w_width = t; t = p->w_alt_height; p->w_alt_height = p->w_height; p->w_height = t; @@ -1078,27 +1055,5 @@ ml = p->w_alt_hlines; p->w_alt_hlines = p->w_hlines; p->w_hlines = ml; t = p->w_alt_histidx; p->w_alt_histidx = p->w_histidx; p->w_histidx = t; #endif -} - -void -EnterAltScreen(p) -struct win *p; -{ - int ox = p->w_x, oy = p->w_y; - FreeAltScreen(p); - SwapAltScreen(p); - ChangeWindowSize(p, p->w_alt_width, p->w_alt_height, p->w_alt_histheight); - p->w_x = ox; - p->w_y = oy; -} - -void -LeaveAltScreen(p) -struct win *p; -{ - if (!p->w_alt_mlines) - return; - SwapAltScreen(p); ChangeWindowSize(p, p->w_alt_width, p->w_alt_height, p->w_alt_histheight); - FreeAltScreen(p); } --- window.h.O Thu Aug 21 07:57:30 2003 +++ window.h Mon Jan 16 06:04:01 2006 @@ -265,6 +265,7 @@ struct event w_telconnev; #endif struct mline *w_alt_mlines; + int w_alt_buf; int w_alt_width; int w_alt_height; int w_alt_histheight;