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.

svn path=/trunk/; revision=56350
This commit is contained in:
Timo Kreuzer 2012-04-14 22:22:20 +00:00
parent ece4aa3f3f
commit 24cace2a24

View file

@ -506,6 +506,41 @@ int __cdecl compare(const void *arg1,const void *arg2)
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)
{
/* Length of string before we complete it */
@ -695,8 +730,8 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
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;