diff options
author | Eduardo Chappa <chappa@washington.edu> | 2016-05-29 17:40:39 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2016-05-29 17:40:39 -0600 |
commit | 9abb6857918960af55433274d71829832a74a47d (patch) | |
tree | 967505a64aa613080a86baa0e506b8b77b508e49 /pico/file.c | |
parent | 0e9b405ad29edbf0c1cfde0357d8b5c6353fc194 (diff) | |
download | alpine-9abb6857918960af55433274d71829832a74a47d.tar.xz |
* The TAB key allows autocomplete in the Fcc field in the composer headers,
as well as autocompletes automatically when only one possibility exists
for the ^J attach command.
Diffstat (limited to 'pico/file.c')
-rw-r--r-- | pico/file.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pico/file.c b/pico/file.c index 149971f0..1b41f181 100644 --- a/pico/file.c +++ b/pico/file.c @@ -1016,7 +1016,7 @@ int pico_fncomplete(char *dirarg, char *fn, size_t fnlen) { char *p, *dlist, tmp[NLINE], dir[NLINE]; - int n, i, match = -1; + int n, i, match = -1, orign; #ifdef DOS #define FILECMP(x, y) (toupper((unsigned char)(x))\ == toupper((unsigned char)(y))) @@ -1027,9 +1027,16 @@ pico_fncomplete(char *dirarg, char *fn, size_t fnlen) strncpy(dir, dirarg, sizeof(dir)); dir[sizeof(dir)-1] = '\0'; pfnexpand(dir, sizeof(dir)); - if(*fn && (dlist = p = getfnames(dir, fn, &n, NULL, 0))){ + if((dlist = p = getfnames(dir, fn, &n, NULL, 0))){ + orign = n; memset(tmp, 0, sizeof(tmp)); while(n--){ /* any names in it */ + if(strcmp(p, ".") == 0 || strcmp(p, "..") == 0){ + p += strlen(p) + 1; + orign--; + continue; + } + for(i = 0; i < sizeof(tmp)-1 && fn[i] && FILECMP(p[i], fn[i]); i++) ; @@ -1054,6 +1061,9 @@ pico_fncomplete(char *dirarg, char *fn, size_t fnlen) free(dlist); } + if(fn[0] == '\0' && orign != 1) + match = -1; + if(match >= 0){ strncpy(fn, tmp, fnlen); fn[fnlen-1] = '\0'; |