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.9 2001/06/25 15:19:31 skimo Exp $ (Berkeley) $Date: 2001/06/25 15:19:31 $";
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(SCR
*orig
, SCR
*sp
)
39 VI_PRIVATE
*ovip
, *nvip
;
41 /* Create the private vi structure. */
42 CALLOC_RET(orig
, nvip
, VI_PRIVATE
*, 1, sizeof(VI_PRIVATE
));
43 sp
->vi_private
= nvip
;
45 /* Invalidate the line size cache. */
49 nvip
->csearchdir
= CNOTSET
;
53 /* User can replay the last input, but nothing else. */
54 if (ovip
->rep_len
!= 0) {
55 MALLOC_RET(orig
, nvip
->rep
, EVENT
*, ovip
->rep_len
);
56 memmove(nvip
->rep
, ovip
->rep
, ovip
->rep_len
);
57 nvip
->rep_len
= ovip
->rep_len
;
60 /* Copy the paragraph/section information. */
61 if (ovip
->ps
!= NULL
&& (nvip
->ps
=
62 v_strdup(sp
, ovip
->ps
, strlen(ovip
->ps
))) == NULL
)
65 nvip
->lastckey
= ovip
->lastckey
;
66 nvip
->csearchdir
= ovip
->csearchdir
;
68 nvip
->srows
= ovip
->srows
;
77 * PUBLIC: int v_screen_end __P((SCR *));
84 if ((vip
= VIP(sp
)) == NULL
)
86 if (vip
->keyw
!= NULL
)
97 sp
->vi_private
= NULL
;
104 * Handle change of options for vi.
106 * PUBLIC: int v_optchange __P((SCR *, int, char *, u_long *));
109 v_optchange(SCR
*sp
, int offset
, char *str
, u_long
*valp
)
113 return (v_buildps(sp
, str
, O_STR(sp
, O_SECTIONS
)));
115 return (v_buildps(sp
, O_STR(sp
, O_PARAGRAPHS
), str
));
117 return (vs_crel(sp
, *valp
));