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

Function raw_clear_screen

sys/windows/consoletty.c:1473–1517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1471}
1472
1473void
1474raw_clear_screen(void)
1475{
1476 if (WINDOWPORT(tty)) {
1477 cell_t * back = console.back_buffer;
1478 cell_t * front = console.front_buffer;
1479 COORD pos;
1480 DWORD unused;
1481
1482#ifdef VIRTUAL_TERMINAL_SEQUENCES
1483 pos.Y = 0;
1484 pos.X = 0;
1485 SetConsoleCursorPosition(console.hConOut, pos);
1486 emit_return_to_default();
1487#endif /* VIRTUAL_TERMINAL_SEQUENCES */
1488 for (pos.Y = 0; pos.Y < console.height; pos.Y++) {
1489 for (pos.X = 0; pos.X < console.width; pos.X++) {
1490#ifndef VIRTUAL_TERMINAL_SEQUENCES
1491 WriteConsoleOutputAttribute(console.hConOut, &back->attribute,
1492 1, pos, &unused);
1493 front->attribute = back->attribute;
1494 if (console.has_unicode) {
1495 WriteConsoleOutputCharacterW(console.hConOut,
1496 &back->character, 1, pos, &unused);
1497 } else {
1498 char ch = (char)back->character;
1499 WriteConsoleOutputCharacterA(console.hConOut, &ch, 1, pos,
1500 &unused);
1501 }
1502#else /* VIRTUAL_TERMINAL_SEQUENCES */
1503 *back = clear_cell;
1504 if (console.has_unicode)
1505 WriteConsoleW(console.hConOut, &back->wcharacter, 1,
1506 &unused, NULL);
1507 else
1508 WriteConsoleA(console.hConOut, (LPCSTR) back->utf8str,
1509 (int) strlen((char *) back->utf8str), &unused, NULL);
1510#endif /* VIRTUAL_TERMINAL_SEQUENCES */
1511 *front = *back;
1512 back++;
1513 front++;
1514 }
1515 }
1516 }
1517}
1518
1519void
1520term_clear_screen(void)

Callers 2

tty_self_recover_promptFunction · 0.85
VA_DECLFunction · 0.85

Calls 1

emit_return_to_defaultFunction · 0.85

Tested by

no test coverage detected