int wrefresh(WINDOW *win) { short *bnsch, *ensch; SLK_MAP *slk; int wx, wy, nc, boty, clby, idby, *hs, curwin; curwin = (win == curscr); /* don't allow curscr refresh if the screen was just created */ if (curwin && curscr->_sync) return (OK); /* go thru _stdbody */ if (!curwin && (win != _virtscr)) (void) wnoutrefresh(win); /* if there is typeahead */ if ((_INPUTPENDING = _chkinput()) == TRUE) { if (curwin) curscr->_clear = TRUE; return (OK); } if (curwin || curscr->_clear) _virtscr->_clear = TRUE; /* save curscr cursor coordinates */ cy = curscr->_cury; cx = curscr->_curx; /* to simplify code in some cases */ marks = _MARKS; color_marks = _COLOR_MARKS; scrli = curscr->_maxy; scrco = curscr->_maxx; slk = SP->slk; outchcount = 0; /* make sure we're in program mode */ if (SP->fl_endwin) { /* If endwin is equal to 2 it means we just did a newscreen. */ if (SP->fl_endwin == TRUE) { (void) reset_prog_mode(); if (SP->kp_state) (void) tputs(keypad_xmit, 1, _outch); if (slk) (*_do_slk_tch)(); if (SP->fl_meta) (void) tputs(meta_on, 1, _outch); if (cur_term->_cursorstate != 1) _PUTS(cur_term->cursor_seq[cur_term-> _cursorstate], 0); } _PUTS(enter_ca_mode, 1); (void) tputs(ena_acs, 1, _outch); if (exit_attribute_mode) _PUTS(tparm_p0(exit_attribute_mode), 1); else /* * If there is no exit_attribute mode, then vidupdate * could only possibly turn off one of the below three * so that's all we ask it turn off. */ vidupdate(A_NORMAL, (A_ALTCHARSET | A_STANDOUT | A_UNDERLINE), _outch); SP->fl_endwin = FALSE; #ifdef _VR2_COMPAT_CODE _endwin = (char) FALSE; #endif /* _VR2_COMPAT_CODE */ } /* clear the screen if required */ if (_virtscr->_clear) { /* SS: colors */ if (back_color_erase) _turn_off_background(); _PUTS(clear_screen, scrli); cy = cx = curscr->_curx = curscr->_cury = 0; /* _sync indicates that this a new screen */ if (!curscr->_sync) (void) werase(curscr); else { nc = scrco / BITSPERBYTE - (scrco % BITSPERBYTE ? 0 : 1); wy = scrli - 1; bnsch = _BEGNS; ensch = _ENDNS; hs = _CURHASH; for (; wy >= 0; --wy) { *bnsch++ = scrco; *ensch++ = -1; *hs++ = 0; if (marks) for (wx = nc; wx >= 0; --wx) marks[wy][wx] = 0; } } _virtscr->_clear = curscr->_sync = curscr->_clear = FALSE; if (slk) (*_do_slk_tch)(); /* pretend _virtscr has been totally changed */ (void) wtouchln(_virtscr, 0, scrli, -1); _VIRTTOP = 0; _VIRTBOT = scrli - 1; /* will not do clear-eod or ins/del lines */ clby = idby = scrli; } else clby = idby = -1; /* Software soft labels; if _changed == 2, slk's are in clear mode. */ if (slk && slk->_win && (slk->_changed == TRUE)) (*_do_slk_noref)(); /* do line updating */ _virtscr->_clear = FALSE; wy = _VIRTTOP; boty = _VIRTBOT + 1; bnsch = _virtscr->_firstch + wy; ensch = _virtscr->_lastch + wy; for (; wy < boty; ++wy, ++bnsch, ++ensch) { /* this line is up-to-date */ if (*bnsch >= scrco) goto next; /* there is type-ahead */ if (!curwin && (_INPUTPENDING = _chkinput()) == TRUE) { /* LINTED */ _VIRTTOP = (short) wy; goto done; } if (clby < 0) { /* now we have to work, check for ceod */ clby = _getceod(wy, boty); /* check for insert/delete lines */ if (_virtscr->_use_idl) idby = (*_setidln)(); } /* try clear-to-eod */ if (wy == clby) _useceod(wy, boty); /* try ins/del lines */ if (wy == idby) { curscr->_cury = cy; curscr->_curx = cx; (*_useidln)(); cy = curscr->_cury; cx = curscr->_curx; } if (*bnsch < scrco) _updateln(wy); next: *bnsch = _INFINITY; *ensch = -1; } /* do hardware soft labels; if _changed == 2, */ /* slk's are in clear mode. */ if (slk && (slk->_changed == TRUE) && !(slk->_win)) (*_do_slk_ref)(); /* move cursor */ wy = _virtscr->_cury; wx = _virtscr->_curx; if (wy != cy || wx != cx) { (void) mvcur(cy, cx, wy, wx); /* LINTED */ cy = (short) wy; /* LINTED */ cx = (short) wx; } /* reset the flags */ curscr->_clear = FALSE; _virtscr->_use_idl = FALSE; _virtscr->_use_idc = TRUE; _INPUTPENDING = FALSE; /* virtual image is now up-to-date */ _VIRTTOP = scrli; _VIRTBOT = -1; done : curscr->_cury = cy; curscr->_curx = cx; (void) fflush(SP->term_file); return (outchcount); }
int vidputs(_ochtype a, int (*o)(char)) { vidupdate(_FROM_OCHTYPE(a), cur_term->sgr_mode, o); return (OK); }