From ad8356897959aad8aa3467b17ed6021b00b65632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Mon, 5 Jul 2004 22:12:45 +0000 Subject: [PATCH] Patch by Jens Collin Fixes autocompletion, see bug #177 svn path=/trunk/; revision=10002 --- reactos/subsys/system/cmd/filecomp.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/reactos/subsys/system/cmd/filecomp.c b/reactos/subsys/system/cmd/filecomp.c index b79ce848756..9ed63022ac8 100644 --- a/reactos/subsys/system/cmd/filecomp.c +++ b/reactos/subsys/system/cmd/filecomp.c @@ -14,6 +14,10 @@ * * 30-Apr-2004 (Filip Navara ) * Make the file listing readable when there is a lot of long names. + * + + * 05-Jul-2004 (Jens Collin ) + * Now expands lfn even when trailing " is omitted. */ #include "config.h" @@ -25,7 +29,7 @@ #include #include -#include "cmd.h" +#include "cmd.h" #ifdef FEATURE_UNIX_FILENAME_COMPLETION @@ -37,6 +41,7 @@ VOID CompleteFilename (LPTSTR str, INT charcount) INT curplace = 0; INT start; INT count; + INT step, c; BOOL found_dot = FALSE; BOOL perfectmatch = TRUE; TCHAR path[MAX_PATH]; @@ -50,8 +55,18 @@ VOID CompleteFilename (LPTSTR str, INT charcount) if (count < 0) count = 0; + /* find how many '"'s there is typed already.*/ + step = count; + while (step > 0) + { + if (str[step] == _T('"')) + c++; + step--; + } + /* if c is odd, then user typed " before name, else not.*/ + /* find front of word */ - if (str[count] == _T('"')) + if (str[count] == _T('"') || (c % 2)) { count--; while (count > 0 && str[count] != _T('"')) @@ -256,9 +271,9 @@ BOOL ShowCompletionMatches (LPTSTR str, INT charcount) if (curplace >= 0 && directory[curplace] == _T('"')) directory[curplace--] = _T('\0'); - + _tcscpy (path, directory); - + while (curplace >= 0 && directory[curplace] != _T('\\') && directory[curplace] != _T(':')) @@ -312,13 +327,13 @@ BOOL ShowCompletionMatches (LPTSTR str, INT charcount) /* Increase by the number of spaces behind file name */ longestfname += 3; - + /* find anything */ ConOutChar (_T('\n')); do { /* ignore . and .. */ - if (!_tcscmp (file.cFileName, _T(".")) || + if (!_tcscmp (file.cFileName, _T(".")) || !_tcscmp (file.cFileName, _T(".."))) continue;