From d1444fe09ade94fc002eba1ef15ce3ef88883e31 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Thu, 15 May 2003 10:14:27 +0000 Subject: [PATCH] added down patch from Guillaume Serre Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1010 --- src/shell/shell_misc.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/shell/shell_misc.cpp b/src/shell/shell_misc.cpp index 49eb6d91..92ede224 100644 --- a/src/shell/shell_misc.cpp +++ b/src/shell/shell_misc.cpp @@ -90,7 +90,31 @@ void DOS_Shell::InputCommand(char * line) { break; case 0x48: /* UP */ - if (it_history == l_history.end()) break; + if (l_history.empty() || it_history == l_history.end()) break; + + for (;str_index>0; str_index--) { + // removes all characters + outc(8); outc(' '); outc(8); + } + strcpy(line, it_history->c_str()); + len = it_history->length(); + str_len = str_index = len; + size = CMD_MAXLINE - str_index - 1; + DOS_WriteFile(STDOUT, (Bit8u *)line, &len); + it_history ++; + + break; + + case 0x50: /* DOWN */ + if (l_history.empty() || it_history == l_history.begin()) break; + + // not very nice but works .. + it_history --; + if (it_history == l_history.begin()) { + // no previous commands in history + it_history ++; + break; + } else it_history --; for (;str_index>0; str_index--) { // removes all characters @@ -101,9 +125,7 @@ void DOS_Shell::InputCommand(char * line) { str_len = str_index = len; size = CMD_MAXLINE - str_index - 1; DOS_WriteFile(STDOUT, (Bit8u *)line, &len); - it_history ++; - if (it_history == l_history.end()) it_history = l_history.begin(); break;