2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
9 static char sccsid
[] = "$Id: v_z.c,v 8.5 1993/10/03 13:01:44 bostic Exp $ (Berkeley) $Date: 1993/10/03 13:01:44 $";
12 #include <sys/types.h>
18 * v_z -- [count]z[count][-.+^<CR>]
22 v_z(sp
, ep
, vp
, fm
, tm
, rp
)
31 * The first count is the line to use. If the value doesn't
32 * exist, use the last line.
34 if (F_ISSET(vp
, VC_C1SET
)) {
36 if (file_lline(sp
, ep
, &last
))
43 /* The second count is the window size. */
44 if (F_ISSET(vp
, VC_C2SET
) && set_window_size(sp
, vp
->count2
, 0))
47 /* Set default cursor values. */
51 switch (vp
->character
) {
52 case '-': /* Put the line at the bottom. */
53 if (sp
->s_fill(sp
, ep
, lno
, P_BOTTOM
))
56 case '.': /* Put the line in the middle. */
57 if (sp
->s_fill(sp
, ep
, lno
, P_MIDDLE
))
60 default: /* Put the line at the top for <cr>. */
61 if (sp
->special
[vp
->character
] != K_CR
&&
62 sp
->special
[vp
->character
] != K_NL
) {
63 msgq(sp
, M_ERR
, "usage: %s.", vp
->kp
->usage
);
67 case '+': /* Put the line at the top. */
68 if (sp
->s_fill(sp
, ep
, lno
, P_TOP
))
71 case '^': /* Print the screen before the z- screen. */
74 * Historic practice isn't real clear on this one. It seems
75 * that the command "70z^" is the same as ":70<cr>z-z^" with
76 * an off-by-one difference. So, until I find documentation
77 * to the contrary, the z^ command in this implementation
78 * displays the screen immediately before the current one.
79 * Fill the screen with the selected line at the bottom, then,
80 * scroll the screen down a page, and move to the middle line
81 * of the screen. Historic vi moved the cursor to some random
82 * place in the screen, as far as I can tell.
84 if (sp
->s_fill(sp
, ep
, lno
, P_BOTTOM
))
86 if (sp
->s_down(sp
, ep
, rp
, sp
->t_maxrows
- 1, 1))
88 if (sp
->s_position(sp
, ep
, rp
, 0, P_MIDDLE
))
93 /* If the map changes, have to redraw the entire screen. */