Much more sane matches allocation, beep when multiple matches found, or none...
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@273 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
b684805da7
commit
7d97ce7baf
22
files.c
22
files.c
|
@ -532,12 +532,12 @@ char **username_tab_completion(char *buf, int *num_matches)
|
|||
|
||||
char **cwd_tab_completion(char *buf, int *num_matches)
|
||||
{
|
||||
char *dirName, *tmp = NULL;
|
||||
char *dirName, *tmp = NULL, *tmp2 = NULL;
|
||||
char **matches = (char **) NULL;
|
||||
DIR *dir;
|
||||
struct dirent *next;
|
||||
|
||||
matches = malloc(sizeof(char *) * 50);
|
||||
matches = nmalloc(1024);
|
||||
|
||||
/* Stick a wildcard onto the buf, for later use */
|
||||
strcat(buf, "*");
|
||||
|
@ -587,11 +587,15 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
|||
#endif
|
||||
/* See if this matches */
|
||||
if (check_wildcard_match(next->d_name, tmp) == TRUE) {
|
||||
/* Cool, found a match. Add it to the list */
|
||||
matches[*num_matches] = malloc(strlen(next->d_name) + 1);
|
||||
strcpy(matches[*num_matches], next->d_name);
|
||||
|
||||
/* Cool, found a match. Add it to the list
|
||||
* This makes a lot more sense to me (Chris) this way...
|
||||
*/
|
||||
tmp2 = NULL;
|
||||
tmp2 = nmalloc(strlen(next->d_name) + 1);
|
||||
strcpy(tmp2, next->d_name);
|
||||
matches[*num_matches] = tmp2;
|
||||
++*num_matches;
|
||||
//matches = realloc( matches, sizeof(char*)*(*num_matches));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,6 +637,7 @@ int input_tab(char *buf, int place, int lastWasTab)
|
|||
if (matches != NULL) {
|
||||
free(matches);
|
||||
matches = (char **) NULL;
|
||||
num_matches = 0;
|
||||
}
|
||||
|
||||
/* If the word starts with `~' and there is no slash in the word,
|
||||
|
@ -735,9 +740,8 @@ int input_tab(char *buf, int place, int lastWasTab)
|
|||
}
|
||||
free(foo);
|
||||
wrefresh(edit);
|
||||
num_matches = 0;
|
||||
} else
|
||||
beep();
|
||||
}
|
||||
beep();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2000-11-05 21:59-0500\n"
|
||||
"POT-Creation-Date: 2000-11-05 23:04-0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -107,7 +107,7 @@ msgstr ""
|
|||
msgid "File exists, OVERWRITE ?"
|
||||
msgstr ""
|
||||
|
||||
#: files.c:730
|
||||
#: files.c:735
|
||||
msgid "(more)"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue