From: ak1 Date: Sun, 9 Jan 2005 19:05:59 +0000 (+0000) Subject: Andreas Krennmair: X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=f353d90d89bbdaa8ff3f3c619384948ec8fe9c14 Andreas Krennmair: fixed bug with ajg.last-folder patch that simply stopped input when pressing '.' (not really great when entering email addresses). git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@13 e385b8ad-14ed-0310-8656-cc95a2468c6d --- diff --git a/curs_lib.c b/curs_lib.c index 1eb0911..a764b6a 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -119,6 +119,29 @@ int _mutt_get_field (/* const */ char *field, char *buf, size_t buflen, int comp return (ret); } +int _mutt_get_field_att (/* const */ char *field, char *buf, size_t buflen, int complete, int multiple, char ***files, int *numfiles) +{ + int ret; + int x, y; + + ENTER_STATE *es = mutt_new_enter_state(); + + do + { + CLEARLINE (LINES-1); + addstr (field); + mutt_refresh (); + getyx (stdscr, y, x); + ret = _mutt_enter_string_att (buf, buflen, y, x, complete, multiple, files, numfiles, es); + } + while (ret == 1); + CLEARLINE (LINES-1); + mutt_free_enter_state (&es); + + return (ret); +} + + int mutt_get_password (char *msg, char *buf, size_t buflen) { int rc; diff --git a/curs_main.c b/curs_main.c index 25b20e0..3835af7 100644 --- a/curs_main.c +++ b/curs_main.c @@ -385,7 +385,7 @@ static void update_index (MUTTMENU *menu, CONTEXT *ctx, int check, if (menu->current < 0) menu->current = ci_first_message (); - + } static void resort_index (MUTTMENU *menu) diff --git a/enter.c b/enter.c index d6b3954..4636c3a 100644 --- a/enter.c +++ b/enter.c @@ -32,6 +32,8 @@ enum M_REDRAW_LINE /* redraw entire line */ }; +static int _mutt_enter_string_foo (char *buf, size_t buflen, int y, int x, int flags, int multiple, char ***files, int *numfiles, ENTER_STATE *state, int att_save); + static int my_wcwidth (wchar_t wc) { int n = wcwidth (wc); @@ -184,9 +186,23 @@ int mutt_enter_string(char *buf, size_t buflen, int y, int x, int flags) return rv; } -int _mutt_enter_string (char *buf, size_t buflen, int y, int x, +int _mutt_enter_string(char *buf, size_t buflen, int y, int x, + int flags, int multiple, char ***files, int *numfiles, + ENTER_STATE *state) +{ + return _mutt_enter_string_foo(buf,buflen,y,x,flags,multiple,files,numfiles,state,0); +} + +int _mutt_enter_string_att(char *buf, size_t buflen, int y, int x, int flags, int multiple, char ***files, int *numfiles, ENTER_STATE *state) +{ + return _mutt_enter_string_foo(buf,buflen,y,x,flags,multiple,files,numfiles,state,1); +} + +static int _mutt_enter_string_foo (char *buf, size_t buflen, int y, int x, + int flags, int multiple, char ***files, int *numfiles, + ENTER_STATE *state, int att_save) /* the last parameter is a hack!! */ { int width = COLS - x - 1; int redraw; @@ -614,7 +630,7 @@ self_insert: /* use the raw keypress */ ch = LastKey; - if (ch == '.') + if (att_save && ch == '.') { rv = 2; goto bye; diff --git a/protos.h b/protos.h index c272e29..7bfde2a 100644 --- a/protos.h +++ b/protos.h @@ -275,8 +275,11 @@ int mutt_resend_message (FILE *, CONTEXT *, HEADER *); int _mutt_enter_fname (const char *, char *, size_t, int *, int, int, char ***, int *); int mutt_enter_string (char *buf, size_t buflen, int y, int x, int flags); int _mutt_enter_string (char *, size_t, int, int, int, int, char ***, int *, ENTER_STATE *); +int _mutt_enter_string_att (char *, size_t, int, int, int, int, char ***, int *, ENTER_STATE *); #define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL) +#define mutt_get_field_att(A,B,C,D) _mutt_get_field_att(A,B,C,D,0,NULL,NULL) int _mutt_get_field (char *, char *, size_t, int, int, char ***, int *); +int _mutt_get_field_att (char *, char *, size_t, int, int, char ***, int *); int mutt_get_hook_type (const char *); int mutt_get_password (char *, char *, size_t); int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t); diff --git a/recvattach.c b/recvattach.c index 4157649..db4b5fd 100644 --- a/recvattach.c +++ b/recvattach.c @@ -419,7 +419,7 @@ static int mutt_query_save_attachment (FILE *fp, BODY *body, HEADER *hdr, char * prompt = _("Save to file: "); while (prompt) { - ret = mutt_get_field (_("Save to file ('.' for last used folder): ") + ret = mutt_get_field_att (_("Save to file ('.' for last used folder): ") , buf, sizeof (buf), M_FILE | M_CLEAR); if (((ret != 0) && (ret != 2)) || (!buf[0])) return -1;