[*] Adjust console history behaviour
This commit is contained in:
parent
342db487f9
commit
4b5bbe7be4
@ -126,7 +126,8 @@ namespace Aurora::Console::ConsoleTTY
|
||||
{
|
||||
|
||||
if (this->noncanonicalCursorPosInBytes == 0 ||
|
||||
this->GetHintLines() == 0)
|
||||
this->GetHintLines() == 0 ||
|
||||
this->noncanonicalCursorPosInBytes == this->inputField.size())
|
||||
{
|
||||
NoncanonicalOnHistoryDown();
|
||||
}
|
||||
@ -141,7 +142,8 @@ namespace Aurora::Console::ConsoleTTY
|
||||
{
|
||||
|
||||
if (this->noncanonicalCursorPosInBytes == 0 ||
|
||||
this->GetHintLines() == 0)
|
||||
this->GetHintLines() == 0 ||
|
||||
this->noncanonicalCursorPosInBytes == this->inputField.size())
|
||||
{
|
||||
NoncanonicalOnHistoryUp();
|
||||
}
|
||||
@ -322,6 +324,13 @@ namespace Aurora::Console::ConsoleTTY
|
||||
|
||||
void TTYConsole::NoncanonicalOnHistoryUp()
|
||||
{
|
||||
bool locked {};
|
||||
if (this->noncanonicalCursorPos == 0 ||
|
||||
noncanonicalCursorPosInBytes == this->inputField.size())
|
||||
{
|
||||
locked = true;
|
||||
}
|
||||
|
||||
if (this->iHistoryPos == -1)
|
||||
{
|
||||
this->iHistoryPos = this->history.size();
|
||||
@ -336,10 +345,24 @@ namespace Aurora::Console::ConsoleTTY
|
||||
|
||||
this->inputField = this->history[this->iHistoryPos];
|
||||
HistoryUpdateCursor();
|
||||
|
||||
if (locked)
|
||||
{
|
||||
this->noncanonicalCursorPos = GuessWidth(this->inputField);
|
||||
this->noncanonicalCursorPosInBytes = this->inputField.size();
|
||||
NoncanonicalSetCursor();
|
||||
}
|
||||
}
|
||||
|
||||
void TTYConsole::NoncanonicalOnHistoryDown()
|
||||
{
|
||||
bool locked {};
|
||||
if (this->noncanonicalCursorPos == 0 ||
|
||||
noncanonicalCursorPosInBytes == this->inputField.size())
|
||||
{
|
||||
locked = true;
|
||||
}
|
||||
|
||||
if (this->iHistoryPos == -1)
|
||||
{
|
||||
return;
|
||||
@ -358,6 +381,13 @@ namespace Aurora::Console::ConsoleTTY
|
||||
}
|
||||
|
||||
HistoryUpdateCursor();
|
||||
|
||||
if (locked)
|
||||
{
|
||||
this->noncanonicalCursorPos = GuessWidth(this->inputField);
|
||||
this->noncanonicalCursorPosInBytes = this->inputField.size();
|
||||
NoncanonicalSetCursor();
|
||||
}
|
||||
}
|
||||
|
||||
void TTYConsole::HistoryUpdateCursor()
|
||||
|
Loading…
Reference in New Issue
Block a user