MCPcopy Create free account
hub / github.com/NetHack/NetHack / tty_putstatusfield

Function tty_putstatusfield

win/tty/wintty.c:4802–4840  ·  view source on GitHub ↗

* This is what places a field on the tty display. */

Source from the content-addressed store, hash-verified

4800 * This is what places a field on the tty display.
4801 */
4802static void
4803tty_putstatusfield(const char *text, int x, int y)
4804{
4805 int i, n, ncols, nrows, lth = 0;
4806 struct WinDesc *cw = 0;
4807
4808 if (WIN_STATUS == WIN_ERR
4809 || (cw = wins[WIN_STATUS]) == (struct WinDesc *) 0)
4810 panic("tty_putstatusfield: Invalid WinDesc\n");
4811
4812 ncols = cw->cols;
4813 nrows = cw->maxrow;
4814 lth = (int) strlen(text);
4815
4816 print_vt_code2(AVTC_SELECT_WINDOW, NHW_STATUS);
4817
4818 if (x < ncols && y < nrows) {
4819 if (x != cw->curx || y != cw->cury)
4820 tty_curs(NHW_STATUS, x, y);
4821 for (i = 0; i < lth; ++i) {
4822 n = i + x;
4823 if (n < ncols && *text) {
4824 (void) putchar(*text);
4825 ttyDisplay->curx++;
4826 cw->curx++;
4827 cw->data[y][n - 1] = *text;
4828 text++;
4829 }
4830 }
4831 }
4832#if 0
4833 else {
4834 if (truncation_expected) {
4835 /* Now we're truncating */
4836 ; /* but we knew in advance */
4837 }
4838 }
4839#endif
4840}
4841
4842/* caller must set cond_shrinklvl (0..2) before calling us */
4843static void

Callers 1

render_statusFunction · 0.85

Calls 2

tty_cursFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected