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_left.c,v 8.3 1993/12/16 12:03:25 bostic Exp $ (Berkeley) $Date: 1993/12/16 12:03:25 $";
12 #include <sys/types.h>
18 * v_left -- [count]^H, [count]h
19 * Move left by columns.
22 v_left(sp
, ep
, vp
, fm
, tm
, rp
)
30 cnt
= F_ISSET(vp
, VC_C1SET
) ? vp
->count
: 1;
33 msgq(sp
, M_BERR
, "Already in the first column.");
39 rp
->cno
= fm
->cno
- cnt
;
46 * v_cfirst -- [count]_
48 * Move to the first non-blank column on a line.
51 v_cfirst(sp
, ep
, vp
, fm
, tm
, rp
)
60 * A count moves down count - 1 rows, so, "3_" is the same as "2j_".
63 * Historically, if the _ is a motion, it is always a line motion,
64 * and the line motion flag is set.
66 cnt
= F_ISSET(vp
, VC_C1SET
) ? vp
->count
: 1;
69 if (v_down(sp
, ep
, vp
, fm
, tm
, rp
))
71 if (F_ISSET(vp
, VC_C
| VC_D
| VC_Y
))
76 if (nonblank(sp
, ep
, rp
->lno
, &rp
->cno
))
83 * Move to the first non-blank column on this line.
86 v_first(sp
, ep
, vp
, fm
, tm
, rp
)
93 * Yielding to none in our quest for compatibility with every
94 * historical blemish of vi, no matter how strange it might be,
95 * we permit the user to enter a count and then ignore it.
98 if (nonblank(sp
, ep
, fm
->lno
, &rp
->cno
))
106 * Move to column count or the first column on this line. If the
107 * requested column is past EOL, move to EOL. The nasty part is
108 * that we have to know character column widths to make this work.
111 v_ncol(sp
, ep
, vp
, fm
, tm
, rp
)
117 if (F_ISSET(vp
, VC_C1SET
) && vp
->count
> 1)
119 sp
->s_chposition(sp
, ep
, fm
->lno
, (size_t)--vp
->count
);
128 * Move to the first column on this line.
131 v_zero(sp
, ep
, vp
, fm
, tm
, rp
)