[*] Scar seething
This commit is contained in:
parent
0ff345a558
commit
ab030ae969
@ -610,7 +610,6 @@ namespace Aurora::Console::ConsoleStd
|
||||
}
|
||||
|
||||
SetConsoleMode(gInputStream, gCanonicalBackup);
|
||||
|
||||
gWin32Thread = CreateThread(nullptr, 0, StdInWin32Thread, nullptr, 0, nullptr);
|
||||
}
|
||||
|
||||
|
@ -366,16 +366,28 @@ namespace Aurora::Console::ConsoleTTY
|
||||
|
||||
void TTYConsole::End()
|
||||
{
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
SetConsoleActiveScreenBuffer(GetStdHandle(STD_OUTPUT_HANDLE));
|
||||
#endif
|
||||
|
||||
if (!AuExchange(gTTYConsoleEnabled, false))
|
||||
{
|
||||
#if defined(AURORA_IS_POSIX_DERIVED)
|
||||
TTYWrite("\033[?1049l");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (NoncanonicalMode())
|
||||
if (this->NoncanonicalMode())
|
||||
{
|
||||
ConsoleStd::LeaveNoncanonicalMode();
|
||||
}
|
||||
|
||||
if (this->PermitDoubleBuffering())
|
||||
{
|
||||
EndBuffering();
|
||||
}
|
||||
|
||||
TTYClearScreen();
|
||||
TTYClearLine(EAnsiColor::eReset);
|
||||
|
||||
@ -582,7 +594,7 @@ namespace Aurora::Console::ConsoleTTY
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void EnterScrollMode()
|
||||
{
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
@ -615,7 +627,7 @@ namespace Aurora::Console::ConsoleTTY
|
||||
}
|
||||
}
|
||||
|
||||
AuStaticCast<TTYConsole>(GetTTYConsole())->uxModeFlipped = true;
|
||||
gTTYConsole.uxModeFlipped = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -651,7 +663,34 @@ namespace Aurora::Console::ConsoleTTY
|
||||
}
|
||||
}
|
||||
|
||||
AuStaticCast<TTYConsole>(GetTTYConsole())->uxModeFlipped = true; // TODO?
|
||||
gTTYConsole.uxModeFlipped = false;
|
||||
gTTYConsole.uxFlipTime = AuTime::SteadyClockNS(); // Auto timeout
|
||||
|
||||
// TODO: we should use our other exit paths to capture panic and unsafe shutdown events
|
||||
{
|
||||
static AuInitOnce gInitOnce;
|
||||
gInitOnce.Call([]()
|
||||
{
|
||||
atexit([]()
|
||||
{
|
||||
EnterScrollMode();
|
||||
Exit();
|
||||
});
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ScrollModeTick()
|
||||
{
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
if (!gTTYConsole.uxModeFlipped)
|
||||
{
|
||||
if (gTTYConsole.uxFlipTime + AuMSToNS<AuUInt64>(AuSToMS<AuUInt64>(8)) <= AuTime::SteadyClockNS())
|
||||
{
|
||||
EnterScrollMode();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -704,10 +743,10 @@ namespace Aurora::Console::ConsoleTTY
|
||||
|
||||
AuConsole::DispatchRawLine(this->inputField.inputField);
|
||||
}
|
||||
|
||||
AuTryInsert(this->history, this->inputField.inputField);
|
||||
}
|
||||
|
||||
AuTryInsert(this->history, this->inputField.inputField);
|
||||
|
||||
this->inputField.Clear();
|
||||
|
||||
OnEnter();
|
||||
@ -987,6 +1026,8 @@ namespace Aurora::Console::ConsoleTTY
|
||||
//SysBenchmark("history");
|
||||
PumpHistory();
|
||||
}
|
||||
|
||||
ScrollModeTick();
|
||||
}
|
||||
|
||||
void TTYConsole::OnEnter()
|
||||
|
@ -66,8 +66,9 @@ namespace Aurora::Console::ConsoleTTY
|
||||
|
||||
bool Start() override;
|
||||
void End() override;
|
||||
|
||||
|
||||
bool uxModeFlipped {};
|
||||
AuUInt64 uxFlipTime {};
|
||||
|
||||
inline void SignalRedraw()
|
||||
{
|
||||
|
@ -292,16 +292,17 @@ namespace Aurora::Debug
|
||||
|
||||
ReportStackTrace(backtrace, "");
|
||||
|
||||
Exit::PostLevel(pThread, Aurora::Exit::ETriggerLevel::eFatalException);
|
||||
|
||||
try
|
||||
{
|
||||
if (isCritical || gRuntimeConfig.debug.bIsExceptionThrowFatal) // exception = literally anything
|
||||
if (isCritical ||
|
||||
gRuntimeConfig.debug.bIsExceptionThrowFatal) // exception = literally anything
|
||||
{
|
||||
Exit::PostLevel(pThread, Aurora::Exit::ETriggerLevel::eFatalException);
|
||||
PlatformHandleFatalEx2(true, ctx, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Exit::PostLevel(pThread, Aurora::Exit::ETriggerLevel::eProblematicEvent);
|
||||
PlatformHandleFatalEx2(false, ctx, true);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,12 @@
|
||||
|
||||
#include <Source/Debug/MemoryCrunch.hpp>
|
||||
|
||||
namespace Aurora::Console::ConsoleTTY
|
||||
{
|
||||
void EnterScrollMode();
|
||||
void Exit();
|
||||
}
|
||||
|
||||
namespace Aurora::Exit
|
||||
{
|
||||
static AuThreadPrimitives::Mutex gMutex;
|
||||
@ -95,6 +101,12 @@ namespace Aurora::Exit
|
||||
{
|
||||
Grug::GrugFlushWrites();
|
||||
Grug::GrugFlushFlushs();
|
||||
|
||||
#if defined(AURORA_PLATFORM_WIN32)
|
||||
Aurora::Console::ConsoleTTY::EnterScrollMode();
|
||||
#endif
|
||||
|
||||
Aurora::Console::ConsoleTTY::Exit();
|
||||
}
|
||||
|
||||
gProblemCounter = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user