Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/nvi/dist/cl When resizing nvi in xterm, a scrol...



details:   https://anonhg.NetBSD.org/src/rev/1a4766900eac
branches:  trunk
changeset: 356095:1a4766900eac
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Fri Sep 01 07:21:01 2017 +0000

description:
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)

diffstat:

 external/bsd/nvi/dist/cl/cl_main.c   |  8 ++++++--
 external/bsd/nvi/dist/cl/cl_screen.c |  6 +++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diffs (56 lines):

diff -r 97a0d5c95706 -r 1a4766900eac external/bsd/nvi/dist/cl/cl_main.c
--- a/external/bsd/nvi/dist/cl/cl_main.c        Fri Sep 01 07:01:06 2017 +0000
+++ b/external/bsd/nvi/dist/cl/cl_main.c        Fri Sep 01 07:21:01 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cl_main.c,v 1.5 2015/11/25 20:25:20 christos Exp $ */
+/*     $NetBSD: cl_main.c,v 1.6 2017/09/01 07:21:01 mlelstv 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.5 2015/11/25 20:25:20 christos Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.6 2017/09/01 07:21:01 mlelstv Exp $");
 #endif
 
 #include <sys/types.h>
@@ -311,6 +311,10 @@
                continue;
 
        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
 
diff -r 97a0d5c95706 -r 1a4766900eac external/bsd/nvi/dist/cl/cl_screen.c
--- a/external/bsd/nvi/dist/cl/cl_screen.c      Fri Sep 01 07:01:06 2017 +0000
+++ b/external/bsd/nvi/dist/cl/cl_screen.c      Fri Sep 01 07:21:01 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cl_screen.c,v 1.5 2015/11/25 20:25:20 christos Exp $ */
+/*     $NetBSD: cl_screen.c,v 1.6 2017/09/01 07:21:01 mlelstv 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.5 2015/11/25 20:25:20 christos Exp $");
+__RCSID("$NetBSD: cl_screen.c,v 1.6 2017/09/01 07:21:01 mlelstv Exp $");
 #endif
 
 #include <sys/types.h>
@@ -430,7 +430,7 @@
         * 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);



Home | Main Index | Thread Index | Old Index