Files
Arquivotheca.Solaris-2.5/lib/libcurses/screen/quick_echo.c
seta75D 7c4988eac0 Init
2021-10-11 19:38:01 -03:00

74 lines
1.9 KiB
C
Executable File

/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)quick_echo.c 1.5 92/07/14 SMI" /* SVr4.0 1.13 */
#include "curses_inc.h"
extern int outchcount;
/*
* These routines short-circuit much of the innards of curses in order to get
* a single character output to the screen quickly! It is used by waddch().
*/
_quick_echo(win, ch)
register WINDOW *win;
chtype ch;
{
#ifdef __STDC__
extern int _outch(char);
#else
extern int _outch();
#endif
int y = win->_cury;
register int SPy = y + win->_begy + win->_yoffset;
register int SPx = (win->_curx - 1) + win->_begx;
register chtype rawc = _CHAR(ch), rawattrs = _ATTR(ch);
if ((curscr->_flags & _CANT_BE_IMMED) || (win->_flags & _WINCHANGED) ||
(win->_clear) || (curscr->_clear) || (_virtscr->_flags & _WINCHANGED) ||
(SPy > ((LINES + SP->Yabove) - 1)) || (SPx > (COLS - 1)) ||
(SP->slk && (SP->slk->_changed == TRUE)))
{
win->_flags |= _WINCHANGED;
return (wrefresh (win));
}
outchcount = 0;
win->_firstch[y] = _INFINITY;
win->_lastch[y] = -1;
/* If the cursor is not in the right place, put it there! */
if ((SPy != curscr->_cury) || (SPx != curscr->_curx))
{
(void) mvcur (curscr->_cury, curscr->_curx, SPy, SPx);
curscr->_cury = SPy;
}
curscr->_curx = SPx + 1;
_CURHASH[SPy] = _NOHASH;
if (ch != ' ')
{
if (SPx > _ENDNS[SPy])
_ENDNS[SPy] = SPx;
if (SPx < _BEGNS[SPy])
_BEGNS[SPy] = SPx;
}
_virtscr->_y[SPy][SPx] = curscr->_y[SPy][SPx] = ch;
if (rawattrs != curscr->_attrs)
_VIDS(rawattrs, curscr->_attrs);
if (SP->phys_irm)
_OFFINSERT();
/* Write it out! */
_outch((chtype) rawc);
(void) fflush(SP->term_file);
return (outchcount);
}