Module Name:    src
Committed By:   snj
Date:           Mon Oct 23 18:50:37 UTC 2017

Modified Files:
        src/external/bsd/nvi/dist/cl [netbsd-7-0]: cl_main.c cl_screen.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1508):
        external/bsd/nvi/dist/cl/cl_main.c: revision 1.6
        external/bsd/nvi/dist/cl/cl_screen.c: revision 1.6
When resizing nvi in xterm, a scroll region is set with the old size
which garbles the display.
The scroll region is set for a terminfo scroll operation and then
reset to the current window size. While xterm lets you clear a
scroll region, there is no way to do this in terminfo except by
resetting the terminal which has a visual side effect.
Xterm actually clears the scroll region as part of the resize but
that happens before a program gets the SIGWINCH signal. When nvi sees
the SIGWINCH signal, it exits the vi mode using a scroll operation to
tidy up the display before it reenters vi mode with the new window size.
This patch does two things:
- make nvi also invoke a previous SIGWINCH handler (not sufficient,
  but that's how curses wants it).
- skip the tidy up in case of a restart (avoids the scroll region)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.10.1 src/external/bsd/nvi/dist/cl/cl_main.c \
    src/external/bsd/nvi/dist/cl/cl_screen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.4 src/external/bsd/nvi/dist/cl/cl_main.c:1.4.10.1
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.4	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/cl/cl_main.c	Mon Oct 23 18:50:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_main.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: cl_main.c,v 1.4.10.1 2017/10/23 18:50:37 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp  (Berkeley) Date: 2001/07/29 19:07:27 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_main.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.4.10.1 2017/10/23 18:50:37 snj Exp $");
 #endif
 
 #include <sys/types.h>
@@ -294,6 +294,10 @@ h_winch(int signo)
 	GLOBAL_CLP;
 
 	F_SET(clp, CL_SIGWINCH);
+
+	/* If there was a previous handler, call that. */
+	if (clp->oact[INDX_WINCH].sa_handler)
+		clp->oact[INDX_WINCH].sa_handler(signo);
 }
 #undef	GLOBAL_CLP
 
Index: src/external/bsd/nvi/dist/cl/cl_screen.c
diff -u src/external/bsd/nvi/dist/cl/cl_screen.c:1.4 src/external/bsd/nvi/dist/cl/cl_screen.c:1.4.10.1
--- src/external/bsd/nvi/dist/cl/cl_screen.c:1.4	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/cl/cl_screen.c	Mon Oct 23 18:50:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_screen.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: cl_screen.c,v 1.4.10.1 2017/10/23 18:50:37 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo Exp  (Berkeley) Date: 2002/05/03 19:59:44 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_screen.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: cl_screen.c,v 1.4.10.1 2017/10/23 18:50:37 snj Exp $");
 #endif
 
 #include <sys/types.h>
@@ -404,7 +404,7 @@ cl_vi_end(GS *gp)
 	 * Move to the bottom of the window (some endwin implementations don't
 	 * do this for you).
 	 */
-	if (!F_ISSET(clp, CL_IN_EX)) {
+	if (!F_ISSET(clp, CL_IN_EX) && !F_ISSET(gp, G_SRESTART)) {
 		(void)move(0, 0);
 		(void)deleteln();
 		(void)move(LINES - 1, 0);

Reply via email to