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]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
40 #pragma ident "%Z%%M% %I% %E% SMI"
44 #include <sys/types.h>
46 #include "curses_inc.h"
48 /* This routine clears up to the end of line. */
51 wclrtoeol(WINDOW
*win
)
55 int maxx
= win
->_maxx
;
62 if (ISMBIT(win
->_y
[y
][x
])) {
64 if (_mbvalid(win
) == ERR
)
68 if (ISMBIT(win
->_y
[y
][maxx
- 1])) {
69 for (cx
= maxx
- 1; cx
>= x
; --cx
)
70 if (!ISCBIT(win
->_y
[y
][cx
]))
72 wc
= RBYTE(win
->_y
[y
][cx
]);
73 if (cx
+ _curs_scrwidth
[TYPE(wc
)] > maxx
)
79 memSset(&win
->_y
[y
][x
], win
->_bkgd
, maxx
- x
);
82 #ifdef _VR3_COMPAT_CODE
84 (*_y16update
)(win
, 1, maxx
- x
, y
, x
);
85 #endif /* _VR3_COMPAT_CODE */
87 /* if curscr, reset blank structure */
91 _BEGNS
[y
] = (short) maxx
;
93 _ENDNS
[y
] = _BEGNS
[y
] > x
? -1 : x
-1;
95 _CURHASH
[y
] = x
== 0 ? 0 : _NOHASH
;
98 char *mkp
= _MARKS
[y
];
100 BITSPERBYTE
+ (COLS
%BITSPERBYTE
? 1 : 0);
101 int m
= x
/ BITSPERBYTE
+ 1;
103 for (; m
< endx
; ++m
)
105 mkp
+= x
/ BITSPERBYTE
;
106 if ((m
= x
% BITSPERBYTE
) == 0)
109 for (; m
< BITSPERBYTE
; ++m
)
112 /* if color terminal, do the same for color marks */
114 if (_COLOR_MARKS
!= NULL
) {
115 mkp
= _COLOR_MARKS
[y
];
117 m
= x
/ BITSPERBYTE
+ 1;
118 for (; m
< endx
; ++m
)
120 mkp
+= x
/ BITSPERBYTE
;
121 if ((m
= x
% BITSPERBYTE
) == 0)
124 for (; m
< BITSPERBYTE
; ++m
)
130 /* update firstch and lastch for the line. */
133 fprintf(outf
, "CLRTOEOL: line %d begx = %d, maxx = %d, "
134 "lastch = %d, next firstch %d\n", y
, win
->_begx
,
135 win
->_firstch
[y
], win
->_lastch
[y
], win
->_firstch
[y
+1]);
138 if (win
->_firstch
[y
] > x
)
140 win
->_firstch
[y
] = (short) x
;
141 win
->_lastch
[y
] = maxx
- 1;
142 win
->_flags
|= _WINCHANGED
;
143 /* sync with ancestors structures */
147 return (win
->_immed
? wrefresh(win
) : OK
);