[ros-diffs] [tkreuzer] 56350: [CMD] Add quotes to autocompleted names, when certain characters are present, not only spaces. Not sure if that's really all, but should be the most common.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sat Apr 14 22:22:21 UTC 2012


Author: tkreuzer
Date: Sat Apr 14 22:22:20 2012
New Revision: 56350

URL: http://svn.reactos.org/svn/reactos?rev=56350&view=rev
Log:
[CMD]
Add quotes to autocompleted names, when certain characters are present, not only spaces. Not sure if that's really all, but should be the most common.

Modified:
    trunk/reactos/base/shell/cmd/filecomp.c

Modified: trunk/reactos/base/shell/cmd/filecomp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/filecomp.c?rev=56350&r1=56349&r2=56350&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/filecomp.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/filecomp.c [iso-8859-1] Sat Apr 14 22:22:20 2012
@@ -505,6 +505,41 @@
 	cmd_free(File2);
 	return ret;
 }
+
+BOOL
+FileNameContainsSpecialCharacters(LPTSTR pszFileName)
+{
+    TCHAR chr;
+
+    while ((chr = *pszFileName++) != _T('\0'))
+    {
+        if ((chr == _T(' ')) ||
+            (chr == _T('!')) ||
+            (chr == _T('%')) ||
+            (chr == _T('&')) ||
+            (chr == _T('(')) ||
+            (chr == _T(')')) ||
+            (chr == _T('{')) ||
+            (chr == _T('}')) ||
+            (chr == _T('[')) ||
+            (chr == _T(']')) ||
+            (chr == _T('=')) ||
+            (chr == _T('\'')) ||
+            (chr == _T('`')) ||
+            (chr == _T(',')) ||
+            (chr == _T(';')) ||
+            (chr == _T('^')) ||
+            (chr == _T('~')) ||
+            (chr == _T('+')) ||
+            (chr == 0xB4)) // '´'
+        {
+            return TRUE;
+        }
+    }
+
+    return FALSE;
+}
+
 
 VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
 {
@@ -695,8 +730,8 @@
 	   so return the first thing in the list */
 	strOut[0] = _T('\0');
 
-	/* space in the name */
-	if(_tcschr(FileList[Sel].Name, _T(' ')))
+	/* Special character in the name */
+	if (FileNameContainsSpecialCharacters(FileList[Sel].Name))
 	{
 		INT LastSpace;
 		BOOL bInside;




More information about the Ros-diffs mailing list