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_put.c,v 8.5 1993/11/13 18:01:41 bostic Exp $ (Berkeley) $Date: 1993/11/13 18:01:41 $";
12 #include <sys/types.h>
17 static void inc_buf
__P((SCR
*, VICMDARG
*));
21 * Insert the contents of the buffer before the cursor.
24 v_Put(sp
, ep
, vp
, fm
, tm
, rp
)
30 if (F_ISSET(vp
, VC_ISDOT
))
33 F_ISSET(vp
, VC_BUFFER
) ? vp
->buffer
: DEFCB
, fm
, rp
, 0));
38 * Insert the contents of the buffer after the cursor.
41 v_put(sp
, ep
, vp
, fm
, tm
, rp
)
47 if (F_ISSET(vp
, VC_ISDOT
))
51 F_ISSET(vp
, VC_BUFFER
) ? vp
->buffer
: DEFCB
, fm
, rp
, 1));
55 * Historical whackadoo. The dot command `puts' the numbered buffer
56 * after the last one put. For example, `"4p.' would put buffer #4
57 * and buffer #5. If the user continued to enter '.', the #9 buffer
58 * would be repeatedly output. This was not documented, and is a bit
59 * tricky to reconstruct. Historical versions of vi also dropped the
60 * contents of the default buffer after each put, so after `"4p' the
61 * default buffer would be empty. This makes no sense to me, so we
62 * don't bother. Don't assume sequential order of numeric characters.
64 * And, if that weren't exciting enough, failed commands don't normally
65 * set the dot command. Well, boys and girls, an exception is that
66 * the buffer increment gets done regardless of the success of the put.
103 VIP(sp
)->sdot
.buffer
= vp
->buffer
= v
;