2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/* Copyright (c) 1988 AT&T */
2N/A/* All Rights Reserved */
2N/A
2N/A
2N/A/*
2N/A * Copyright (c) 1997, by Sun Microsystems, Inc.
2N/A * All rights reserved.
2N/A */
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A/*LINTLIBRARY*/
2N/A
2N/A#include <sys/types.h>
2N/A#include "curses_inc.h"
2N/A
2N/A/*
2N/A * Move(cury, curx) of win to(y, x).
2N/A * It is guaranteed that the cursor is left at the start
2N/A * of a whole character nearest to(y, x).
2N/A */
2N/A
2N/Aint
2N/Awmbmove(WINDOW *win, int y, int x)
2N/A{
2N/A chtype *wcp, *wp, *ep;
2N/A
2N/A if (y < 0 || x < 0 || y >= win->_maxy || x >= win->_maxx)
2N/A return (ERR);
2N/A
2N/A if (_scrmax > 1) {
2N/A wcp = win->_y[y];
2N/A wp = wcp + x;
2N/A ep = wcp + win->_maxx;
2N/A
2N/A /* make wp points to the start of a character */
2N/A if (ISCBIT(*wp)) {
2N/A for (; wp >= wcp; --wp)
2N/A if (!ISCBIT(*wp))
2N/A break;
2N/A if (wp < wcp) {
2N/A wp = wcp+x+1;
2N/A for (; wp < ep; ++wp)
2N/A if (!ISCBIT(*wp))
2N/A break;
2N/A }
2N/A }
2N/A
2N/A /* make sure that the character is whole */
2N/A if (wp + _curs_scrwidth[TYPE(*wp)] > ep)
2N/A return (ERR);
2N/A
2N/A /* the new x position */
2N/A /*LINTED*/
2N/A x = (int)(wp - wcp);
2N/A }
2N/A
2N/A if (y != win->_cury || x != win->_curx) {
2N/A win->_nbyte = -1;
2N/A /*LINTED*/
2N/A win->_cury = (short)y;
2N/A /*LINTED*/
2N/A win->_curx = (short)x;
2N/A }
2N/A
2N/A return (win->_immed ? wrefresh(win) : OK);
2N/A}