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_right.c,v 8.2 1993/08/16 21:10:07 bostic Exp $ (Berkeley) $Date: 1993/08/16 21:10:07 $";
12 #include <sys/types.h>
18 * v_right -- [count]' ', [count]l
19 * Move right by columns.
21 * Special case: the 'c' and 'd' commands can move past the end of line.
24 v_right(sp
, ep
, vp
, fm
, tm
, rp
)
34 if (file_gline(sp
, ep
, fm
->lno
, &len
) == NULL
) {
35 if (file_lline(sp
, ep
, &lno
))
40 GETLINE_ERR(sp
, fm
->lno
);
45 if (len
== 0 || fm
->cno
== len
- 1) {
46 if (F_ISSET(vp
, VC_C
| VC_D
| VC_Y
)) {
54 cnt
= F_ISSET(vp
, VC_C1SET
) ? vp
->count
: 1;
55 rp
->cno
= fm
->cno
+ cnt
;
56 if (rp
->cno
> len
- 1)
57 if (F_ISSET(vp
, VC_C
| VC_D
| VC_Y
))
65 * v_dollar -- [count]$
66 * Move to the last column.
68 * One of places that you are allowed to move beyond the end of
72 v_dollar(sp
, ep
, vp
, fm
, tm
, rp
)
82 /* A count moves down count - 1 rows, so, "3$" is the same as "2j$". */
83 cnt
= F_ISSET(vp
, VC_C1SET
) ? vp
->count
: 1;
86 if (v_down(sp
, ep
, vp
, fm
, tm
, rp
))
91 if (file_gline(sp
, ep
, fm
->lno
, &len
) == NULL
) {
92 if (file_lline(sp
, ep
, &lno
))
97 GETLINE_ERR(sp
, fm
->lno
);
107 rp
->cno
= F_ISSET(vp
, VC_C
| VC_D
| VC_Y
) ? len
: len
- 1;