Improve console behavior

* Pressing up and down again in the console will result in an empty line,
  not the stay at the last line from history
* Pressing up will really show the last command, not the last-but-one
This commit is contained in:
Daniel Gibson 2012-12-21 04:52:56 +01:00
parent 731428164f
commit ab86006668
2 changed files with 9 additions and 1 deletions

View file

@ -642,6 +642,11 @@ void idConsoleLocal::KeyDownEvent( int key )
{ {
consoleField.SetBuffer( hist ); consoleField.SetBuffer( hist );
} }
else // DG: if no more lines are in the history, show a blank line again
{
consoleField.Clear();
} // DG end
return; return;
} }
@ -1413,4 +1418,4 @@ void idConsoleLocal::DrawDebugGraphs()
{ {
debugGraphs[i]->Render( renderSystem ); debugGraphs[i]->Render( renderSystem );
} }
} }

View file

@ -131,6 +131,9 @@ idStr idConsoleHistory::RetrieveFromHistory( bool backward )
{ {
if( downPoint >= numHistory ) if( downPoint >= numHistory )
{ {
// DG: without this you'll get the last-but-one command when pressing UP
upPoint = downPoint - 1;
// DG end
return idStr( "" ); return idStr( "" );
} }
returnLine = downPoint; returnLine = downPoint;