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.6 1993/11/29 14:15:30 bostic Exp $ (Berkeley) $Date: 1993/11/29 14:15:30 $";
12 #include <sys/types.h>
18 * v_z -- [count]z[count][-.+^<CR>]
22 v_z(sp
, ep
, vp
, fm
, tm
, rp
)
32 * The first count is the line to use. If the value doesn't
33 * exist, use the last line.
35 if (F_ISSET(vp
, VC_C1SET
)) {
37 if (file_lline(sp
, ep
, &last
))
44 /* The second count is the window size. */
45 if (F_ISSET(vp
, VC_C2SET
) && set_window_size(sp
, vp
->count2
, 0))
48 /* Set default cursor values. */
52 switch (vp
->character
) {
53 case '-': /* Put the line at the bottom. */
54 if (sp
->s_fill(sp
, ep
, lno
, P_BOTTOM
))
57 case '.': /* Put the line in the middle. */
58 if (sp
->s_fill(sp
, ep
, lno
, P_MIDDLE
))
61 default: /* Put the line at the top for <cr>. */
62 value
= term_key_val(sp
, vp
->character
);
63 if (value
!= K_CR
&& value
!= K_NL
) {
64 msgq(sp
, M_ERR
, "usage: %s.", vp
->kp
->usage
);
68 case '+': /* Put the line at the top. */
69 if (sp
->s_fill(sp
, ep
, lno
, P_TOP
))
72 case '^': /* Print the screen before the z- screen. */
75 * Historic practice isn't real clear on this one. It seems
76 * that the command "70z^" is the same as ":70<cr>z-z^" with
77 * an off-by-one difference. So, until I find documentation
78 * to the contrary, the z^ command in this implementation
79 * displays the screen immediately before the current one.
80 * Fill the screen with the selected line at the bottom, then,
81 * scroll the screen down a page, and move to the middle line
82 * of the screen. Historic vi moved the cursor to some random
83 * place in the screen, as far as I can tell.
85 if (sp
->s_fill(sp
, ep
, lno
, P_BOTTOM
))
87 if (sp
->s_down(sp
, ep
, rp
, sp
->t_maxrows
- 1, 1))
89 if (sp
->s_position(sp
, ep
, rp
, 0, P_MIDDLE
))
94 /* If the map changes, have to redraw the entire screen. */