summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2016-05-29 17:40:39 -0600
committerEduardo Chappa <chappa@washington.edu>2016-05-29 17:40:39 -0600
commit9abb6857918960af55433274d71829832a74a47d (patch)
tree967505a64aa613080a86baa0e506b8b77b508e49
parent0e9b405ad29edbf0c1cfde0357d8b5c6353fc194 (diff)
downloadalpine-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.
-rw-r--r--alpine/folder.c34
-rw-r--r--alpine/folder.h2
-rw-r--r--alpine/send.c2
-rw-r--r--pico/file.c14
-rw-r--r--pith/pine.hlp4
5 files changed, 52 insertions, 4 deletions
diff --git a/alpine/folder.c b/alpine/folder.c
index be084ed8..b94c9068 100644
--- a/alpine/folder.c
+++ b/alpine/folder.c
@@ -6889,6 +6889,40 @@ get_post_list(char **post_host)
}
+int
+fcc_tab_complete (char *prefix, char **answer, int tabtab, unsigned flags)
+{
+ char tmp[MAILTMPLEN+1];
+ int n;
+ CONTEXT_S *mc;
+
+ if(prefix == NULL || *prefix == '\0')
+ return 0;
+
+ for(mc = ps_global->context_list; mc != NULL; mc = mc->next)
+ if(mc->use & CNTXT_SAVEDFLT)
+ break;
+
+ if(mc == NULL) return 0;
+
+ strncpy(tmp, prefix, sizeof(tmp));
+ tmp[sizeof(tmp)-1] = '\0';
+
+ if(!folder_complete(mc, tmp, sizeof(tmp), &n)){
+ if(n){
+ if(tabtab)
+ display_folder_list(&mc, tmp, 1,folders_for_goto);
+ }
+ else
+ Writechar(BELL, 0);
+ }
+ if(n)
+ *answer = cpystr(tmp);
+ return n == 0 ? 0 : n == 1 ? 2 : 1;
+}
+
+
+
#ifdef _WINDOWS
int
folder_list_popup(sparms, in_handle)
diff --git a/alpine/folder.h b/alpine/folder.h
index 6e9fbee5..f5996efb 100644
--- a/alpine/folder.h
+++ b/alpine/folder.h
@@ -34,6 +34,6 @@ char *context_edit_screen(struct pine *, char *, char *, char *, char *, char
int add_new_folder(CONTEXT_S *, EditWhich, int, char *, size_t, MAILSTREAM *, char *);
char *next_folder(MAILSTREAM **, char *, size_t, char *, CONTEXT_S *, long *, int *);
char *news_group_selector(char **);
-
+int fcc_tab_complete(char *, char **, int, unsigned);
#endif /* PINE_FOLDER_INCLUDED */
diff --git a/alpine/send.c b/alpine/send.c
index dfba59f3..90561345 100644
--- a/alpine/send.c
+++ b/alpine/send.c
@@ -929,7 +929,7 @@ static struct headerentry he_template[]={
news_build, NULL, NULL, news_group_selector, "To NwsGrps", NULL, NULL,
0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, KS_NONE},
{"Fcc : ", "Fcc", h_composer_fcc, 10, 0, NULL,
- NULL, NULL, NULL, folders_for_fcc, "To Fldrs", NULL, NULL,
+ NULL, NULL, NULL, folders_for_fcc, "To Fldrs", NULL, fcc_tab_complete,
0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, KS_NONE},
{"Lcc : ", "Lcc", h_composer_lcc, 10, 0, NULL,
build_addr_lcc, NULL, NULL, addr_book_compose_lcc,"To AddrBk", NULL, abook_nickname_complete,
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';
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 2a02cc2b..23c88ea6 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -207,6 +207,10 @@ Additions include:
subcommand ^N to decode the file name and save the file with the
decoded name.
+ <LI> 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.
+
<LI> Ignore message from smtp server after a successful authentication
challenge.