Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / nvi / vi / v_screen.c
blob888cc6938bbcebf7aeacb9cf3ebdace315d28d9a
1 /* $NetBSD$ */
3 /*-
4 * Copyright (c) 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1992, 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved.
9 * See the LICENSE file for redistribution information.
12 #include "config.h"
14 #ifndef lint
15 static const char sccsid[] = "Id: v_screen.c,v 10.12 2001/06/25 15:19:34 skimo Exp (Berkeley) Date: 2001/06/25 15:19:34";
16 #endif /* not lint */
18 #include <sys/types.h>
19 #include <sys/queue.h>
20 #include <sys/time.h>
22 #include <bitstring.h>
23 #include <limits.h>
24 #include <stdio.h>
26 #include "../common/common.h"
27 #include "vi.h"
30 * v_screen -- ^W
31 * Switch screens.
33 * PUBLIC: int v_screen __P((SCR *, VICMD *));
35 int
36 v_screen(SCR *sp, VICMD *vp)
39 * You can't leave a colon command-line edit window -- it's not that
40 * it won't work, but it gets real weird, real fast when you execute
41 * a colon command out of a window that was forked from a window that's
42 * now backgrounded... You get the idea.
44 if (F_ISSET(sp, SC_COMEDIT)) {
45 msgq(sp, M_ERR,
46 "308|Enter <CR> to execute a command, :q to exit");
47 return (1);
51 * Try for the next lower screen, or, go back to the first
52 * screen on the stack.
54 if (sp->q.cqe_next != (void *)&sp->wp->scrq)
55 sp->nextdisp = sp->q.cqe_next;
56 else if (sp->wp->scrq.cqh_first == sp) {
57 msgq(sp, M_ERR, "187|No other screen to switch to");
58 return (1);
59 } else
60 sp->nextdisp = sp->wp->scrq.cqh_first;
62 F_SET(sp->nextdisp, SC_STATUS);
63 F_SET(sp, SC_SSWITCH | SC_STATUS);
64 return (0);