[*] Selection key spam crash bugfix

This commit is contained in:
Reece Wilson 2023-02-17 22:27:24 +00:00
parent eb13a3c0d1
commit 3e7e5e769a

View File

@ -75,8 +75,15 @@ namespace Aurora::Console::ConsoleTTY
{ {
if (this->highlightStartInBytes) if (this->highlightStartInBytes)
{ {
auto sViewZero = this->inputField.substr(0, this->highlightStartInBytes.value()); auto sViewZero = this->highlightStartInBytes.value() >= this->inputField.size() ?
auto sViewOne = this->inputField.substr(this->highlightStartInBytes.value(), this->highlightEndInBytes.value() - this->highlightStartInBytes.value()); this->inputField :
this->inputField.substr(0, this->highlightStartInBytes.value());
auto sViewOne = this->highlightStartInBytes.value() >= this->inputField.size() ? "" :
this->highlightEndInBytes.value() > this->inputField.size() ? "" :
this->inputField.substr(this->highlightStartInBytes.value(),
this->highlightEndInBytes.value() - this->highlightStartInBytes.value());
auto sViewTwo = this->highlightEndInBytes.value() < this->inputField.size() ? auto sViewTwo = this->highlightEndInBytes.value() < this->inputField.size() ?
this->inputField.substr(this->highlightEndInBytes.value()) : this->inputField.substr(this->highlightEndInBytes.value()) :
""; "";
@ -747,6 +754,8 @@ namespace Aurora::Console::ConsoleTTY
this->inputField.noncanonicalCursorPosInBytes = (int)this->inputField.inputField.size(); this->inputField.noncanonicalCursorPosInBytes = (int)this->inputField.inputField.size();
NoncanonicalSetCursor(); NoncanonicalSetCursor();
} }
this->inputField.DoUnselectTick();
} }
void TTYConsole::NoncanonicalOnHistoryDown() void TTYConsole::NoncanonicalOnHistoryDown()
@ -791,6 +800,8 @@ namespace Aurora::Console::ConsoleTTY
this->inputField.noncanonicalCursorPosInBytes = (int)this->inputField.inputField.size(); this->inputField.noncanonicalCursorPosInBytes = (int)this->inputField.inputField.size();
NoncanonicalSetCursor(); NoncanonicalSetCursor();
} }
this->inputField.DoUnselectTick();
} }
void TTYConsole::HistoryUpdateCursor() void TTYConsole::HistoryUpdateCursor()