input history works in both directions and wraps around

This commit is contained in:
thrust26 2017-10-11 15:13:09 +02:00
parent 5883f2dfcc
commit 39c3ba89bf
1 changed files with 3 additions and 2 deletions

View File

@ -712,8 +712,9 @@ void PromptWidget::historyScroll(int direction)
// Advance to the next line in the history
int line = _historyLine + direction;
if ((direction < 0 && line < 0) || (direction > 0 && line > _historySize))
return;
if(line < 0)
line += _historySize + 1;
line %= (_historySize + 1);
// If they press arrow-up with anything in the buffer, search backwards
// in the history.