[Scummvm-cvs-logs] CVS: scummvm/gui console.cpp,1.14,1.15
Oliver Kiehl
olki at users.sourceforge.net
Sun Dec 15 04:57:03 CET 2002
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv32175
Modified Files:
console.cpp
Log Message:
console now "remembers" the text which the user had typed before using the history
Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- console.cpp 15 Dec 2002 02:24:32 -0000 1.14
+++ console.cpp 15 Dec 2002 12:56:13 -0000 1.15
@@ -331,6 +331,13 @@
{
if (_historySize == 0)
return;
+
+ if (_historyLine == 0 && direction > 0) {
+ int i;
+ for (i = 0; i < _promptEndPos - _promptStartPos; i++)
+ _history[_historyIndex][i] = _buffer[_promptStartPos + i];
+ _history[_historyIndex][i] = '\0';
+ }
// Advance to the next line in the history
int line = _historyLine + direction;
@@ -350,17 +357,17 @@
scrollToCurrent();
// Print the text from the history
- if (_historyLine > 0) {
- int idx = (_historyIndex - _historyLine + _historySize) % _historySize;
- for (int i = 0; i < kLineBufferSize && _history[idx][i] != '\0'; i++)
- putcharIntern(_history[idx][i]);
- _promptEndPos = _currentPos;
+ int idx;
+ if (_historyLine > 0)
+ idx = (_historyIndex - _historyLine + _historySize) % _historySize;
+ else
+ idx = _historyIndex;
+ for (int i = 0; i < kLineBufferSize && _history[idx][i] != '\0'; i++)
+ putcharIntern(_history[idx][i]);
+ _promptEndPos = _currentPos;
- // Ensure once more the caret is visible (in case of very long history entries)
- scrollToCurrent();
- } else {
- // TODO print the text which the user had typed before using the history
- }
+ // Ensure once more the caret is visible (in case of very long history entries)
+ scrollToCurrent();
draw();
}
More information about the Scummvm-git-logs
mailing list