summaryrefslogblamecommitdiff
path: root/user/xterm/revert-xterm-347i.patch
blob: aa49ac3b9cb6b19b28c66208c77760d04610ee76 (plain) (tree)




















































































































































































































                                                                                                      
From 97ef79a674a13f806c58dc7d6eeeaa2e31cbca11 Mon Sep 17 00:00:00 2001
From: Max Rees <maxcrees@me.com>
Date: Sun, 18 Aug 2019 21:12:19 -0500
Subject: [PATCH] Revert "snapshot of project "xterm", label xterm-347i"

The changes introduced in xterm-347i cause a regression in tmux's
"horizontal" (read: one pane on the left, and one pane on the right)
splitting behavior, making the graphical output unstable and unreadable.

This reverts commit 7914e2709aa7836bfb61cd21f83880d4b7d44d8d.
---
 charproc.c | 43 +++++++++++++++----------------------------
 screen.c   |  5 +++--
 util.c     |  3 +--
 xterm.h    | 16 +++-------------
 4 files changed, 22 insertions(+), 45 deletions(-)

diff --git a/charproc.c b/charproc.c
index 5c0536c..3b04842 100644
--- a/charproc.c
+++ b/charproc.c
@@ -1280,7 +1280,7 @@ set_ansi_conformance(TScreen *screen, int level)
  * Set scrolling margins.  VTxxx terminals require that the top/bottom are
  * different, so we have at least two lines in the scrolling region.
  */
-static void
+void
 set_tb_margins(TScreen *screen, int top, int bottom)
 {
     TRACE(("set_tb_margins %d..%d, prior %d..%d\n",
@@ -1297,7 +1297,7 @@ set_tb_margins(TScreen *screen, int top, int bottom)
 	screen->bot_marg = screen->max_row;
 }
 
-static void
+void
 set_lr_margins(TScreen *screen, int left, int right)
 {
     TRACE(("set_lr_margins %d..%d, prior %d..%d\n",
@@ -1317,26 +1317,13 @@ set_lr_margins(TScreen *screen, int left, int right)
 #define reset_tb_margins(screen) set_tb_margins(screen, 0, screen->max_row)
 #define reset_lr_margins(screen) set_lr_margins(screen, 0, screen->max_col)
 
-void
-resetMargins(XtermWidget xw)
+static void
+reset_margins(TScreen *screen)
 {
-    TScreen *screen = TScreenOf(xw);
-
-    UIntClr(xw->flags, LEFT_RIGHT);
     reset_tb_margins(screen);
     reset_lr_margins(screen);
 }
 
-static void
-resetRendition(XtermWidget xw)
-{
-    TScreen *screen = TScreenOf(xw);
-    (void) screen;
-    ResetItalics(xw);
-    UIntClr(xw->flags,
-	    (SGR_MASK | SGR_MASK2 | INVISIBLE));
-}
-
 void
 set_max_col(TScreen *screen, int cols)
 {
@@ -3225,7 +3212,9 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
 		case DEFAULT:
 		    /* FALLTHRU */
 		case 0:
-		    resetRendition(xw);
+		    ResetItalics(xw);
+		    UIntClr(xw->flags,
+			    (SGR_MASK | SGR_MASK2 | INVISIBLE));
 		    if_OPT_ISO_COLORS(screen, {
 			reset_SGR_Colors(xw);
 		    });
@@ -3706,12 +3695,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
 	    TRACE(("CASE_DECALN - alignment test\n"));
 	    if (screen->cursor_state)
 		HideCursor();
-	    /*
-	     * DEC STD 070 does not mention left/right margins.  Likely the
-	     * text was for VT100, and not updated for VT420.
-	     */
-	    resetRendition(xw);
-	    resetMargins(xw);
+	    reset_margins(screen);
 	    CursorSet(screen, 0, 0, xw->flags);
 	    xtermParseRect(xw, 0, 0, &myRect);
 	    ScrnFillRectangle(xw, &myRect, 'E', 0, False);
@@ -6074,13 +6058,16 @@ dpmodes(XtermWidget xw, BitFunc func)
 	    if (screen->c132) {
 		if (!(xw->flags & NOCLEAR_COLM))
 		    ClearScreen(xw);
+		CursorSet(screen, 0, 0, xw->flags);
 		if ((j = IsSM()? 132 : 80) !=
 		    ((xw->flags & IN132COLUMNS) ? 132 : 80) ||
 		    j != MaxCols(screen))
 		    RequestResize(xw, -1, j, True);
 		(*func) (&xw->flags, IN132COLUMNS);
-		resetMargins(xw);
-		CursorSet(screen, 0, 0, xw->flags);
+		if (xw->flags & IN132COLUMNS) {
+		    UIntClr(xw->flags, LEFT_RIGHT);
+		    reset_lr_margins(screen);
+		}
 	    }
 	    break;
 	case srm_DECSCLM:	/* (slow scroll)        */
@@ -10636,7 +10623,7 @@ VTRealize(Widget w,
     set_cur_row(screen, 0);
     set_max_col(screen, Width(screen) / screen->fullVwin.f_width - 1);
     set_max_row(screen, Height(screen) / screen->fullVwin.f_height - 1);
-    resetMargins(xw);
+    reset_margins(screen);
 
     memset(screen->sc, 0, sizeof(screen->sc));
 
@@ -11951,7 +11938,7 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved)
 #endif
 
     /* reset scrolling region */
-    resetMargins(xw);
+    reset_margins(screen);
 
     bitclr(&xw->flags, ORIGIN);
 
diff --git a/screen.c b/screen.c
index 4e8a0bf..2af76bc 100644
--- a/screen.c
+++ b/screen.c
@@ -1,4 +1,4 @@
-/* $XTermId: screen.c,v 1.578 2019/07/19 22:35:41 tom Exp $ */
+/* $XTermId: screen.c,v 1.577 2019/06/30 18:45:09 tom Exp $ */
 
 /*
  * Copyright 1999-2018,2019 by Thomas E. Dickey
@@ -2236,7 +2236,8 @@ ScreenResize(XtermWidget xw,
 	}
 
 	/* adjust scrolling region */
-	resetMargins(xw);
+	set_tb_margins(screen, 0, screen->max_row);
+	set_lr_margins(screen, 0, screen->max_col);
 	UIntClr(*flags, ORIGIN);
 
 	if (screen->cur_row > screen->max_row)
diff --git a/util.c b/util.c
index 7623efa..7300300 100644
--- a/util.c
+++ b/util.c
@@ -1,4 +1,4 @@
-/* $XTermId: util.c,v 1.803 2019/07/20 00:10:34 tom Exp $ */
+/* $XTermId: util.c,v 1.802 2019/07/19 00:40:41 tom Exp $ */
 
 /*
  * Copyright 1999-2018,2019 by Thomas E. Dickey
@@ -3687,7 +3687,6 @@ drawXtermText(XtermWidget xw,
 #define NOT_BOLD (attr_flags & ~BOLDATTR(screen))
 	font = getNormXftFont(xw, attr_flags, &did_ul);
 	font0 = IS_BOLD ? getNormXftFont(xw, NOT_BOLD, &did_ul) : font;
-	(void) font0;
 #if OPT_RENDERWIDE
 	wfont = getWideXftFont(xw, attr_flags);
 	wfont0 = IS_BOLD ? getWideXftFont(xw, NOT_BOLD) : wfont;
diff --git a/xterm.h b/xterm.h
index 89a4482..fecac7f 100644
--- a/xterm.h
+++ b/xterm.h
@@ -1,4 +1,4 @@
-/* $XTermId: xterm.h,v 1.841 2019/07/19 22:35:06 tom Exp $ */
+/* $XTermId: xterm.h,v 1.839 2019/07/19 00:40:41 tom Exp $ */
 
 /*
  * Copyright 1999-2018,2019 by Thomas E. Dickey
@@ -957,11 +957,12 @@ extern void lookupSelectUnit(XtermWidget /* xw */, Cardinal /* item */, String /
 extern void releaseCursorGCs(XtermWidget /*xw*/);
 extern void releaseWindowGCs(XtermWidget /*xw*/, VTwin * /*win*/);
 extern void resetCharsets (TScreen * /* screen */);
-extern void resetMargins (XtermWidget /* xw */);
 extern void restoreCharsets (TScreen * /* screen */, DECNRCM_codes * /* source */);
 extern void saveCharsets (TScreen * /* screen */, DECNRCM_codes * /* target */);
 extern void set_max_col(TScreen *  /* screen */, int  /* cols */);
 extern void set_max_row(TScreen *  /* screen */, int  /* rows */);
+extern void set_lr_margins (TScreen * /* screen */, int  /* left */, int  /* right */);
+extern void set_tb_margins (TScreen * /* screen */, int  /* top */, int  /* bottom */);
 extern void unparse_end (XtermWidget /* xw */);
 extern void unparseputc (XtermWidget /* xw */, int  /* c */);
 extern void unparseputc1 (XtermWidget /* xw */, int  /* c */);
@@ -1406,17 +1407,6 @@ extern void LineSetFlag(LineData /* ld */, int /* flag */);
 #define ScrnIsColInMargins(screen, col) \
 	((col) >= (screen)->lft_marg && (col) <= (screen)->rgt_marg)
 
-/*
- * If the vertical scrolling margins are active, they will be something other
- * than the first/last row of the visible screen, as well as being distinct.
- */
-#define IsTopBottomMode(xw)	(ScrnTopMargin(xw) < ScrnBottomMargin(xw))
-#define ScrnTopMargin(xw)	TScreenOf(xw)->top_marg
-#define ScrnBottomMargin(xw)	TScreenOf(xw)->bot_marg
-
-/*
- * Left/right horizontal scrolling margins are only active when DECLRMM is.
- */
 #define IsLeftRightMode(xw) ((xw)->flags & LEFT_RIGHT)
 #define ScrnLeftMargin(xw)  (IsLeftRightMode(xw) \
 			     ? TScreenOf(xw)->lft_marg \
-- 
2.22.1