mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[CMD] Fix a typo in filename completion (#3293)
Fix filename completion that could cause a incorrect result when the path
contains "dots". (See also HBelusca@d12169b.)
See CORE-8623 and CORE-1901 (bug introduced in r25896 / 54cf74f
).
For example:
- The current directory is `C:\Documents and Settings\Administrator\`, and you
input `".` and press TAB. The completion result would be `".Administrator"`,
which even does not exist.
- You input "some(file).ext", and you remove the final quote (or the quote
and "ext") and you attempt to complete the file name.
- Import two additional fixes from HBelusca@a826730: Fix the search ordering
in the comparisons between szSearch1, szSearch2 and szSearch3.
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
This commit is contained in:
parent
7a2c1f7d0b
commit
a91a709a8d
1 changed files with 5 additions and 5 deletions
|
@ -394,10 +394,10 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
|
|||
/* Find the one closest to end */
|
||||
szSearch1 = _tcsrchr(str, _T('\"'));
|
||||
szSearch2 = _tcsrchr(str, _T('\\'));
|
||||
szSearch3 = _tcsrchr(str, _T('.'));
|
||||
if (szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2))
|
||||
szSearch3 = _tcsrchr(str, _T('/'));
|
||||
if ((szSearch2 != NULL) && (szSearch1 < szSearch2))
|
||||
szSearch = szSearch2;
|
||||
else if (szSearch3 != NULL && _tcslen(szSearch1) > _tcslen(szSearch3))
|
||||
else if ((szSearch3 != NULL) && (szSearch1 < szSearch3))
|
||||
szSearch = szSearch3;
|
||||
else
|
||||
szSearch = szSearch1;
|
||||
|
@ -440,9 +440,9 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
|
|||
szSearch1 = _tcsrchr(str, _T(' '));
|
||||
szSearch2 = _tcsrchr(str, _T('\\'));
|
||||
szSearch3 = _tcsrchr(str, _T('/'));
|
||||
if (szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2))
|
||||
if ((szSearch2 != NULL) && (szSearch1 < szSearch2))
|
||||
szSearch = szSearch2;
|
||||
else if (szSearch3 != NULL && _tcslen(szSearch1) > _tcslen(szSearch3))
|
||||
else if ((szSearch3 != NULL) && (szSearch1 < szSearch3))
|
||||
szSearch = szSearch3;
|
||||
else
|
||||
szSearch = szSearch1;
|
||||
|
|
Loading…
Reference in a new issue