1*e0b8e63eSJohn Marino /*-
2*e0b8e63eSJohn Marino * Copyright (c) 1993, 1994
3*e0b8e63eSJohn Marino * The Regents of the University of California. All rights reserved.
4*e0b8e63eSJohn Marino * Copyright (c) 1992, 1993, 1994, 1995, 1996
5*e0b8e63eSJohn Marino * Keith Bostic. All rights reserved.
6*e0b8e63eSJohn Marino *
7*e0b8e63eSJohn Marino * See the LICENSE file for redistribution information.
8*e0b8e63eSJohn Marino */
9*e0b8e63eSJohn Marino
10*e0b8e63eSJohn Marino #include "config.h"
11*e0b8e63eSJohn Marino
12*e0b8e63eSJohn Marino #include <sys/types.h>
13*e0b8e63eSJohn Marino #include <sys/queue.h>
14*e0b8e63eSJohn Marino #include <sys/time.h>
15*e0b8e63eSJohn Marino
16*e0b8e63eSJohn Marino #include <bitstring.h>
17*e0b8e63eSJohn Marino #include <limits.h>
18*e0b8e63eSJohn Marino #include <stdio.h>
19*e0b8e63eSJohn Marino
20*e0b8e63eSJohn Marino #include "../common/common.h"
21*e0b8e63eSJohn Marino #include "vi.h"
22*e0b8e63eSJohn Marino
23*e0b8e63eSJohn Marino /*
24*e0b8e63eSJohn Marino * v_screen -- ^W
25*e0b8e63eSJohn Marino * Switch screens.
26*e0b8e63eSJohn Marino *
27*e0b8e63eSJohn Marino * PUBLIC: int v_screen(SCR *, VICMD *);
28*e0b8e63eSJohn Marino */
29*e0b8e63eSJohn Marino int
v_screen(SCR * sp,VICMD * vp)30*e0b8e63eSJohn Marino v_screen(SCR *sp, VICMD *vp)
31*e0b8e63eSJohn Marino {
32*e0b8e63eSJohn Marino /*
33*e0b8e63eSJohn Marino * You can't leave a colon command-line edit window -- it's not that
34*e0b8e63eSJohn Marino * it won't work, but it gets real weird, real fast when you execute
35*e0b8e63eSJohn Marino * a colon command out of a window that was forked from a window that's
36*e0b8e63eSJohn Marino * now backgrounded... You get the idea.
37*e0b8e63eSJohn Marino */
38*e0b8e63eSJohn Marino if (F_ISSET(sp, SC_COMEDIT)) {
39*e0b8e63eSJohn Marino msgq(sp, M_ERR,
40*e0b8e63eSJohn Marino "308|Enter <CR> to execute a command, :q to exit");
41*e0b8e63eSJohn Marino return (1);
42*e0b8e63eSJohn Marino }
43*e0b8e63eSJohn Marino
44*e0b8e63eSJohn Marino /*
45*e0b8e63eSJohn Marino * Try for the next lower screen, or, go back to the first
46*e0b8e63eSJohn Marino * screen on the stack.
47*e0b8e63eSJohn Marino */
48*e0b8e63eSJohn Marino if (TAILQ_NEXT(sp, q) != NULL)
49*e0b8e63eSJohn Marino sp->nextdisp = TAILQ_NEXT(sp, q);
50*e0b8e63eSJohn Marino else if (TAILQ_FIRST(sp->gp->dq) == sp) {
51*e0b8e63eSJohn Marino msgq(sp, M_ERR, "187|No other screen to switch to");
52*e0b8e63eSJohn Marino return (1);
53*e0b8e63eSJohn Marino } else
54*e0b8e63eSJohn Marino sp->nextdisp = TAILQ_FIRST(sp->gp->dq);
55*e0b8e63eSJohn Marino
56*e0b8e63eSJohn Marino F_SET(sp->nextdisp, SC_STATUS);
57*e0b8e63eSJohn Marino F_SET(sp, SC_SSWITCH | SC_STATUS);
58*e0b8e63eSJohn Marino return (0);
59*e0b8e63eSJohn Marino }
60