-/* $OpenBSD: cl_screen.c,v 1.22 2014/11/12 16:29:04 millert Exp $ */
+/* $OpenBSD: cl_screen.c,v 1.23 2015/04/10 18:05:51 brynet Exp $ */
/*-
* Copyright (c) 1993, 1994
/* See if the current information is incorrect. */
if (F_ISSET(gp, G_SRESTART)) {
- if (cl_quit(gp))
+ if ((!F_ISSET(sp, SC_SCR_EX | SC_SCR_VI) ||
+ resizeterm(O_VAL(sp, O_LINES), O_VAL(sp, O_COLUMNS))) &&
+ cl_quit(gp))
return (1);
F_CLR(gp, G_SRESTART);
}
o_cols = getenv("COLUMNS");
cl_putenv("COLUMNS", NULL, (u_long)O_VAL(sp, O_COLUMNS));
+ /*
+ * The terminal is aways initialized, either in `main`, or by a
+ * previous call to newterm(3).
+ */
+ (void)del_curterm(cur_term);
+
/*
* We don't care about the SCREEN reference returned by newterm, we
* never have more than one SCREEN at a time.
- *
- * XXX
- * The SunOS initscr() can't be called twice. Don't even think about
- * using it. It fails in subtle ways (e.g. select(2) on fileno(stdin)
- * stops working). (The SVID notes that applications should only call
- * initscr() once.)
- *
- * XXX
- * The HP/UX newterm doesn't support the NULL first argument, so we
- * have to specify the terminal type.
*/
errno = 0;
if (newterm(ttype, stdout, stdin) == NULL) {
/* End curses window. */
(void)endwin();
+ /* Free the SCREEN created by newterm(3). */
+ delscreen(set_term(NULL));
+
/*
* XXX
* The screen TE sequence just got sent. See the comment in
-/* $OpenBSD: cl_term.c,v 1.19 2014/11/12 16:29:04 millert Exp $ */
+/* $OpenBSD: cl_term.c,v 1.20 2015/04/10 18:05:51 brynet Exp $ */
/*-
* Copyright (c) 1993, 1994
clp = CLP(sp);
switch (opt) {
+ case O_TERM:
+ F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
+ /* FALLTHROUGH */
case O_COLUMNS:
case O_LINES:
- case O_TERM:
/*
- * Changing the columns, lines or terminal require that
- * we restart the screen.
+ * Changing the terminal type requires that we reinitialize
+ * curses, while resizing does not.
*/
F_SET(sp->gp, G_SRESTART);
- F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
break;
case O_MESG:
(void)cl_omesg(sp, clp, !*valp);