wclrtobot(WINDOW *win) { int code = ERR; T((T_CALLED("wclrtobot(%p)"), (void *) win)); if (win) { NCURSES_SIZE_T y; NCURSES_SIZE_T startx = win->_curx; NCURSES_CH_T blank = win->_nc_bkgd; T(("clearing from y = %ld to y = %ld with maxx = %ld", (long) win->_cury, (long) win->_maxy, (long) win->_maxx)); for (y = win->_cury; y <= win->_maxy; y++) { struct ldat *line = &(win->_line[y]); NCURSES_CH_T *ptr = &(line->text[startx]); NCURSES_CH_T *end = &(line->text[win->_maxx]); CHANGED_TO_EOL(line, startx, win->_maxx); while (ptr <= end) *ptr++ = blank; startx = 0; } _nc_synchook(win); code = OK; } returnCode(code); }
_nc_insert_wch(WINDOW *win, const cchar_t *wch) { int cells = wcwidth(CharOf(CHDEREF(wch))); int cell; int code = OK; if (cells < 0) { code = winsch(win, (chtype) CharOf(CHDEREF(wch))); } else { if (cells == 0) cells = 1; if (win->_curx <= win->_maxx) { struct ldat *line = &(win->_line[win->_cury]); NCURSES_CH_T *end = &(line->text[win->_curx]); NCURSES_CH_T *temp1 = &(line->text[win->_maxx]); NCURSES_CH_T *temp2 = temp1 - cells; CHANGED_TO_EOL(line, win->_curx, win->_maxx); while (temp1 > end) *temp1-- = *temp2--; *temp1 = _nc_render(win, *wch); for (cell = 1; cell < cells; ++cell) { SetWidecExt(temp1[cell], cell); } win->_curx = (NCURSES_SIZE_T) (win->_curx + cells); } } return code; }
/* * Insert the given character, updating the current location to simplify * inserting a string. */ static int _nc_insert_wch(WINDOW *win, const cchar_t *wch) { int cells = wcwidth(CharOf(CHDEREF(wch))); int cell; if (cells <= 0) cells = 1; if (win->_curx <= win->_maxx) { struct ldat *line = &(win->_line[win->_cury]); NCURSES_CH_T *end = &(line->text[win->_curx]); NCURSES_CH_T *temp1 = &(line->text[win->_maxx]); NCURSES_CH_T *temp2 = temp1 - cells; CHANGED_TO_EOL(line, win->_curx, win->_maxx); while (temp1 > end) *temp1-- = *temp2--; *temp1 = _nc_render(win, *wch); for (cell = 1; cell < cells; ++cell) { SetWidecExt(temp1[cell], cell); } win->_curx++; } return OK; }
int wclrtobot(WINDOW *win) { int code = ERR; T((T_CALLED("wclrtobot(%p)"), win)); if (win) { short y; short startx = win->_curx; chtype blank = _nc_background(win); T(("clearing from y = %d to y = %d with maxx = %d", win->_cury, win->_maxy, win->_maxx)); for (y = win->_cury; y <= win->_maxy; y++) { struct ldat *line = &(win->_line[y]); chtype *ptr = &(line->text[startx]); chtype *end = &(line->text[win->_maxx]); CHANGED_TO_EOL(line, startx, win->_maxx); while (ptr <= end) *ptr++ = blank; startx = 0; } _nc_synchook(win); code = OK; } returnCode(code); }
wclrtoeol(WINDOW *win) { int code = ERR; T((T_CALLED("wclrtoeol(%p)"), (void *) win)); if (win) { NCURSES_CH_T blank; NCURSES_CH_T *ptr, *end; struct ldat *line; NCURSES_SIZE_T y = win->_cury; NCURSES_SIZE_T x = win->_curx; /* * If we have just wrapped the cursor, the clear applies to the * new line, unless we are at the lower right corner. */ if ((win->_flags & _WRAPPED) != 0 && y < win->_maxy) { win->_flags &= ~_WRAPPED; } /* * There's no point in clearing if we're not on a legal * position, either. */ if ((win->_flags & _WRAPPED) != 0 || y > win->_maxy || x > win->_maxx) returnCode(ERR); blank = win->_nc_bkgd; line = &win->_line[y]; CHANGED_TO_EOL(line, x, win->_maxx); ptr = &(line->text[x]); end = &(line->text[win->_maxx]); while (ptr <= end) *ptr++ = blank; _nc_synchook(win); code = OK; } returnCode(code); }
int winsch(WINDOW *win, chtype c) { int code = ERR; T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c))); if (win) { struct ldat *line = &(win->_line[win->_cury]); chtype *end = &(line->text[win->_curx]); chtype *temp1 = &(line->text[win->_maxx]); chtype *temp2 = temp1 - 1; CHANGED_TO_EOL(line, win->_curx, win->_maxx); while (temp1 > end) *temp1-- = *temp2--; *temp1 = _nc_render(win, c); code = OK; } returnCode(code); }
wdelch(WINDOW *win) { int code = ERR; T((T_CALLED("wdelch(%p)"), (void *) win)); if (win) { NCURSES_CH_T blank = win->_nc_bkgd; struct ldat *line = &(win->_line[win->_cury]); NCURSES_CH_T *end = &(line->text[win->_maxx]); NCURSES_CH_T *temp2 = &(line->text[win->_curx + 1]); NCURSES_CH_T *temp1 = temp2 - 1; CHANGED_TO_EOL(line, win->_curx, win->_maxx); while (temp1 < end) *temp1++ = *temp2++; *temp1 = blank; _nc_synchook(win); code = OK; } returnCode(code); }