wins_wch.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1995-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* LINTLIBRARY */
/*
*
* XCurses Library
*
* Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved.
*
*/
#ifdef M_RCSID
#ifndef lint
static char rcsID[] =
"$Header: /team/ps/sun_xcurses/archive/local_changes/xcurses/src/lib/"
"libxcurses/src/libc/xcurses/rcs/wins_wch.c 1.3 1998/06/04 17:54:38 "
"cbates Exp $";
#endif
#endif
#include <private.h>
#include <string.h>
/*
* Insert a character into a window line, shifting the line right
* the column width of the inserted character. The right most columns
* will be truncated according to the width of the character inserted.
*/
int
{
int width;
/* Determine the character width to insert. */
return (-1);
x = __m_cc_first(w, y, x);
/*
* Use erase to remove possible multi-column chars
* before memmove clobbers them
*/
/* Insert a "hole" into the line. */
/* Write the character into the hole. */
return (-1);
/* Update dirty region markers. */
if (x < w->_first[y])
w->_first[y] = (short) x;
/*
* If the last character on the line is incomplete,
* blank it out.
*/
return (width);
}
/*
* Special internal version of wins_wch() that can track the cursor
* position to facilitate inserting strings containing special characters
* like \b, \n, \r, and \t.
*/
int
{
const wchar_t *p;
case L'\r':
x = 0;
break;
case L'\b':
if (0 < x)
--x;
break;
case L'\t':
goto error;
break;
case L'\n':
/* Truncate the tail of the current line. */
goto error;
if (__m_do_scroll(w, y, x, &y, &x) == ERR)
goto error;
break;
default:
goto error;
x += width;
break;
}
/* Convert non-printables into printable representation. */
goto error;
for (; *p != '\0'; ++p, x += width) {
goto error;
}
}
*yp = y;
*xp = x;
WSYNC(w);
return (code);
}
/*
* Insert a character (with attributes) before the cursor. All
* characters to the right of the cursor are moved one space to
* the right, with a possibility of the rightmost character on
* the line being lost. The cursor position does not change.
*/
int
{
int code;
return (code);
}