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