[CMD]
authorGregor Schneider <grschneider@gmail.com>
Sun, 4 Apr 2010 14:04:24 +0000 (14:04 +0000)
committerGregor Schneider <grschneider@gmail.com>
Sun, 4 Apr 2010 14:04:24 +0000 (14:04 +0000)
- Don't prefix double quotation marks during file completion
See issue #4491 for more details.

svn path=/trunk/; revision=46718

reactos/base/shell/cmd/filecomp.c

index 4ca8b83..7cb99a7 100644 (file)
@@ -703,7 +703,7 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
                                LastSpace = i;
 
                }
                                LastSpace = i;
 
                }
-               /* insert the quoation and move things around */
+               /* insert the quotation and move things around */
                if(szPrefix[LastSpace + 1] != _T('\"') && LastSpace != -1)
                {
                        memmove ( &szPrefix[LastSpace+1], &szPrefix[LastSpace], (_tcslen(szPrefix)-LastSpace+1) * sizeof(TCHAR) );
                if(szPrefix[LastSpace + 1] != _T('\"') && LastSpace != -1)
                {
                        memmove ( &szPrefix[LastSpace+1], &szPrefix[LastSpace], (_tcslen(szPrefix)-LastSpace+1) * sizeof(TCHAR) );
@@ -712,14 +712,17 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
                        {
                                _tcscat(szPrefix,_T("\""));
                        }
                        {
                                _tcscat(szPrefix,_T("\""));
                        }
-                               szPrefix[LastSpace + 1] = _T('\"');
+                       szPrefix[LastSpace + 1] = _T('\"');
                }
                else if(LastSpace == -1)
                {
                }
                else if(LastSpace == -1)
                {
-                       _tcscpy(szBaseWord,_T("\""));
-                       _tcscat(szBaseWord,szPrefix);
-                       _tcscpy(szPrefix,szBaseWord);
-
+                       /* Add quotation only if none exists already */
+                       if (szPrefix[0] != _T('\"'))
+                       {
+                               _tcscpy(szBaseWord,_T("\""));
+                               _tcscat(szBaseWord,szPrefix);
+                               _tcscpy(szPrefix,szBaseWord);
+                       }
                }
        }
 
                }
        }