Index: cmdinput.c =================================================================== --- cmdinput.c (revision 52394) +++ cmdinput.c (working copy) @@ -158,13 +158,28 @@ CHAR chr; do { - if (!ReadFile(hStdin, &chr, 1, &dwRead, NULL) || !dwRead) + if (!ReadFile(hStdin, &chr, 1, &dwRead, NULL) || !dwRead) return FALSE; #ifdef _UNICODE - MultiByteToWideChar(InputCodePage, 0, &chr, 1, &str[charcount++], 1); + MultiByteToWideChar(InputCodePage, 0, &chr, 1, &str[charcount], 1); + chr=str[charcount]; #endif - } while (chr != '\n' && charcount < maxlen); + if (chr==8 || chr==127) { + if (charcount>0) { + charcount--; + } else { + str[0]=_T('\0'); + ConOutChar (_T('\r')); /* go to beginning of line and reprint prompt */ + PrintPrompt (); + } + } else if (chr != '\r') { + str[charcount++]=chr; + } + } while (chr != '\n' && charcount < maxlen); str[charcount] = _T('\0'); + ConOutChar (_T('\r')); /* go to beginning of line and reprint prompt and input */ + PrintPrompt (); + ConOutPrintf (_T("%s"), str); return TRUE; }