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_xchar.c,v 8.3 1993/11/04 16:17:27 bostic Exp $ (Berkeley) $Date: 1993/11/04 16:17:27 $";
12 #include <sys/types.h>
18 msgq(sp, M_BERR, "No characters to delete."); \
24 * Deletes the character(s) on which the cursor sits.
27 v_xchar(sp
, ep
, vp
, fm
, tm
, rp
)
38 if (file_gline(sp
, ep
, fm
->lno
, &len
) == NULL
) {
39 if (file_lline(sp
, ep
, &lno
))
43 GETLINE_ERR(sp
, fm
->lno
);
50 cnt
= F_ISSET(vp
, VC_C1SET
) ? vp
->count
: 1;
53 * Deleting from the cursor toward the end of line, w/o moving the
54 * cursor. Note, "2x" at EOL isn't the same as "xx" because the
55 * left movement of the cursor as part of the 'x' command isn't
56 * taken into account. Historically correct.
59 if (cnt
< len
- fm
->cno
) {
60 tm
->cno
= fm
->cno
+ cnt
;
65 m
.cno
= fm
->cno
? fm
->cno
- 1 : 0;
69 F_ISSET(vp
, VC_BUFFER
) ? vp
->buffer
: DEFCB
, fm
, tm
, 0))
71 if (delete(sp
, ep
, fm
, tm
, 0))
80 * Deletes the character(s) immediately before the current cursor
84 v_Xchar(sp
, ep
, vp
, fm
, tm
, rp
)
93 msgq(sp
, M_BERR
, "Already at the left-hand margin.");
98 cnt
= F_ISSET(vp
, VC_C1SET
) ? vp
->count
: 1;
99 fm
->cno
= cnt
>= tm
->cno
? 0 : tm
->cno
- cnt
;
102 F_ISSET(vp
, VC_BUFFER
) ? vp
->buffer
: DEFCB
, fm
, tm
, 0))
104 if (delete(sp
, ep
, fm
, tm
, 0))