mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-28 08:02:54 +00:00
Make completion work with filenames containing spaces.
PR: bin/23526 Submitted by: root@yoda.fwe.pi.musin.de MFC after: 1 week
This commit is contained in:
parent
00a2029a0e
commit
ffad02bd6b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=86550
@ -81,7 +81,7 @@ complete_ambiguous(word, list, words)
|
||||
int list;
|
||||
StringList *words;
|
||||
{
|
||||
char insertstr[MAXPATHLEN];
|
||||
char insertstr[2 * MAXPATHLEN];
|
||||
char *lastmatch;
|
||||
int i, j;
|
||||
size_t matchlen, wordlen;
|
||||
@ -91,7 +91,12 @@ complete_ambiguous(word, list, words)
|
||||
return (CC_ERROR); /* no choices available */
|
||||
|
||||
if (words->sl_cur == 1) { /* only once choice available */
|
||||
(void)strcpy(insertstr, words->sl_str[0]);
|
||||
for (i = 0, j = 0; words->sl_str[0][i] != '\0'; i++) {
|
||||
if (isspace((u_char)words->sl_str[0][i]))
|
||||
insertstr[j++] = '\\';
|
||||
insertstr[j++] = words->sl_str[0][i];
|
||||
}
|
||||
insertstr[j] = '\0';
|
||||
if (el_insertstr(el, insertstr + wordlen) == -1)
|
||||
return (CC_ERROR);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user