mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-05 00:40:26 +00:00
Minor bugs fixed in clear_console functions
- Windows: cursor returns to top-left of console screen buffer - Non-Windows: isatty(stdout) check to prevent CLS from working when stdout is redirected
This commit is contained in:
parent
af0c41316a
commit
877089972b
|
@ -11217,7 +11217,8 @@ static bool clear_console(void)
|
||||||
return false;
|
return false;
|
||||||
ret = (GetConsoleScreenBufferInfo(hConsole, &csbi) &&
|
ret = (GetConsoleScreenBufferInfo(hConsole, &csbi) &&
|
||||||
FillConsoleOutputCharacterA(console, ' ',
|
FillConsoleOutputCharacterA(console, ' ',
|
||||||
csbi.dwSize.X * csbi.dwSize.Y, origin, &nCharsWritten));
|
csbi.dwSize.X * csbi.dwSize.Y, origin, &nCharsWritten) &&
|
||||||
|
SetConsoleCursorPosition(hConsole, origin));
|
||||||
CloseHandle(console);
|
CloseHandle(console);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -11240,6 +11241,8 @@ static int putc_tty(int c)
|
||||||
static bool clear_console(void)
|
static bool clear_console(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
if (!isatty(fileno(stdout)))
|
||||||
|
return false;
|
||||||
ttyfd = open("/dev/tty", O_RDWR);
|
ttyfd = open("/dev/tty", O_RDWR);
|
||||||
if (ttyfd == -1) {
|
if (ttyfd == -1) {
|
||||||
// No controlling TTY for the process?
|
// No controlling TTY for the process?
|
||||||
|
|
Loading…
Reference in a new issue