4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
27 * Copyright (c) 1997, by Sun Microsystems, Inc.
28 * All rights reserved.
31 #pragma ident "%Z%%M% %I% %E% SMI"
35 #include <sys/types.h>
36 #include "curses_inc.h"
39 * Shift right an interval of characters
43 _mbinsshift(WINDOW
*win
, int len
)
46 chtype
*wcp
, *wp
, *ep
;
53 /* ASSERT(!ISCBIT(wcp[x])); */
55 /* shift up to a whole character */
61 for (; wp
>= wcp
; --wp
)
67 if ((wp
+ _curs_scrwidth
[TYPE(rb
)]) > (wcp
+ maxx
))
69 maxx
= (int)(wp
- wcp
);
73 /* see if any data need to move */
74 if ((mv
= maxx
- (x
+len
)) <= 0)
77 /* the end of the moved interval must be whole */
78 if (ISCBIT(wcp
[x
+ mv
]))
79 (void) _mbclrch(win
, y
, x
+ mv
- 1);
83 for (wp
= wcp
+ maxx
- 1; wp
>= ep
; --wp
)
86 /* clear a possible partial multibyte character */
88 for (ep
= wp
; ep
>= wcp
; --ep
) {
89 mv
= (int)(ISCBIT(*ep
));
95 /* update the change structure */
96 if (x
< win
->_firstch
[y
])
98 win
->_firstch
[y
] = (short)x
;
99 win
->_lastch
[y
] = maxx
- 1;