From 42711fd8551f02b936e96d698e200b7f06a53e2a Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Thu, 3 Jul 2003 20:30:48 +0000 Subject: [PATCH] added shell4.patch from Guillaume Serre Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1079 --- src/shell/shell_misc.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/shell/shell_misc.cpp b/src/shell/shell_misc.cpp index 92ede224..efb8c696 100644 --- a/src/shell/shell_misc.cpp +++ b/src/shell/shell_misc.cpp @@ -153,6 +153,7 @@ void DOS_Shell::InputCommand(char * line) { // moves the cursor left while (str_remain--) outc(8); } + if (strlen(line) == 0 && l_completion.size()) l_completion.clear(); break; case 0x0a: /* New Line not handled */ /* Don't care */ @@ -200,8 +201,15 @@ void DOS_Shell::InputCommand(char * line) { dta.GetResult(name,size,date,time,attr); // add result to completion list - if (strcmp(name, ".") && strcmp(name, "..")) - l_completion.push_back(name); + char *ext; // file extension + if (strcmp(name, ".") && strcmp(name, "..")) { + ext = strrchr(name, '.'); + if (ext && (strcmp(ext, ".BAT") == 0 || strcmp(ext, ".COM") == 0 || strcmp(ext, ".EXE") == 0)) + // we add executables to the start of the list + l_completion.push_front(name); + else + l_completion.push_back(name); + } res=DOS_FindNext(); }