historic vi remapped characters in the executed @ buffer
[nvi.git] / vi / v_yank.c
blob554854a58e661137d11cbfd3015ed104f7f6a8dd
1 /*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
6 */
8 #ifndef lint
9 static char sccsid[] = "$Id: v_yank.c,v 8.9 1993/11/04 16:17:28 bostic Exp $ (Berkeley) $Date: 1993/11/04 16:17:28 $";
10 #endif /* not lint */
12 #include <sys/types.h>
14 #include "vi.h"
15 #include "vcmd.h"
18 * v_yank -- [buffer][count]Y
19 * [buffer][count]y[count][motion]
20 * Yank text (or lines of text) into a cut buffer.
22 int
23 v_yank(sp, ep, vp, fm, tm, rp)
24 SCR *sp;
25 EXF *ep;
26 VICMDARG *vp;
27 MARK *fm, *tm, *rp;
29 if (F_ISSET(vp, VC_LMODE)) {
30 if (file_gline(sp, ep, tm->lno, NULL) == NULL) {
31 v_eof(sp, ep, fm);
32 return (1);
34 if (cut(sp, ep,
35 F_ISSET(vp, VC_BUFFER) ? vp->buffer : DEFCB, fm, tm, 1))
36 return (1);
37 } else if (cut(sp, ep,
38 F_ISSET(vp, VC_BUFFER) ? vp->buffer : DEFCB, fm, tm, 0))
39 return (1);
41 sp->rptlines[L_YANKED] += tm->lno - fm->lno + 1;
42 return (0);