xref: /titanic_51/usr/src/lib/libcurses/screen/wadjcurspos.c (revision 69bb4bb45c98da60d21839c4dc3c01ea1be60585)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1988 by Sun Microsystems, Inc.
24  */
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include	<sys/types.h>
29 #include	"curses_inc.h"
30 
31 int
32 wadjcurspos(WINDOW *win)
33 	/*
34 	 * wmadjcurspos --- moves the cursor to the first column within the
35 	 * multi-column character somewhere on which the cursor curently is on.
36 	 */
37 {
38 	short	x;
39 	chtype	*_yy;
40 
41 	x = win->_curx;
42 	_yy = win->_y[win->_cury];
43 	while ((x > 0) && (ISCBIT(_yy[x]))) --x;
44 	if (win->_curx != x) {
45 		win->_curx = x;
46 		return (win->_immed ? wrefresh(win): OK);
47 	} else {
48 		return (OK);
49 	}
50 }
51