2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1992, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
13 static const char sccsid
[] = "$Id: v_init.c,v 10.8 1996/03/30 13:47:10 bostic Exp $ (Berkeley) $Date: 1996/03/30 13:47:10 $";
16 #include <sys/types.h>
17 #include <sys/queue.h>
20 #include <bitstring.h>
27 #include "../common/common.h"
34 * PUBLIC: int v_screen_copy __P((SCR *, SCR *));
37 v_screen_copy(orig
, sp
)
40 VI_PRIVATE
*ovip
, *nvip
;
42 /* Create the private vi structure. */
43 CALLOC_RET(orig
, nvip
, VI_PRIVATE
*, 1, sizeof(VI_PRIVATE
));
44 sp
->vi_private
= nvip
;
46 /* Invalidate the line size cache. */
50 nvip
->csearchdir
= CNOTSET
;
54 /* User can replay the last input, but nothing else. */
55 if (ovip
->rep_len
!= 0) {
56 MALLOC_RET(orig
, nvip
->rep
, EVENT
*, ovip
->rep_len
);
57 memmove(nvip
->rep
, ovip
->rep
, ovip
->rep_len
);
58 nvip
->rep_len
= ovip
->rep_len
;
61 /* Copy the paragraph/section information. */
62 if (ovip
->ps
!= NULL
&& (nvip
->ps
=
63 v_strdup(sp
, ovip
->ps
, strlen(ovip
->ps
))) == NULL
)
66 nvip
->lastckey
= ovip
->lastckey
;
67 nvip
->csearchdir
= ovip
->csearchdir
;
69 nvip
->srows
= ovip
->srows
;
78 * PUBLIC: int v_screen_end __P((SCR *));
86 if ((vip
= VIP(sp
)) == NULL
)
88 if (vip
->keyw
!= NULL
)
99 sp
->vi_private
= NULL
;
106 * Handle change of options for vi.
108 * PUBLIC: int v_optchange __P((SCR *, int, char *, u_long *));
111 v_optchange(sp
, offset
, str
, valp
)
119 return (v_buildps(sp
, str
, O_STR(sp
, O_SECTIONS
)));
121 return (v_buildps(sp
, O_STR(sp
, O_PARAGRAPHS
), str
));
123 return (vs_crel(sp
, *valp
));