diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1998-06-16 00:22:10 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1998-06-16 00:22:10 +0000 |
commit | 3fbf23455f182c757e22ceca4d438215b5929b26 (patch) | |
tree | 7092d75fb3084b5ddcbb69b05f2b2fef1efec0e0 /menu.c | |
parent | a07d9f79f6a533ec83d64dda1c824e3a81c2d493 (diff) |
Including Vikas' search code for the "attach message" menu.
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -574,14 +574,21 @@ void mutt_menuDestroy (MUTTMENU **p) static int menu_search (MUTTMENU *menu, int op) { int r; - int searchDir = (menu->searchDir == M_SEARCH_UP) ? -1 : 1; + int searchDir; regex_t re; char buf[SHORT_STRING]; + /* Need to search the folder using the pattern matching language, + * not plain regexps. mutt_search_command() does just this */ + if (menu->search == (int (*)(MUTTMENU *, regex_t *, int)) -1 ) + return mutt_search_command (menu->data, menu->current, op); + if (op != OP_SEARCH_NEXT && op != OP_SEARCH_OPPOSITE) { strfcpy (buf, menu->searchBuf ? menu->searchBuf : "", sizeof (buf)); - if (mutt_get_field ("Search for: ", buf, sizeof (buf), M_CLEAR) != 0 || !buf[0]) + if (mutt_get_field ((op == OP_SEARCH) ? "Search for: " : + "Reverse search for: ", + buf, sizeof (buf), M_CLEAR) != 0 || !buf[0]) return (-1); safe_free ((void **) &menu->searchBuf); menu->searchBuf = safe_strdup (buf); @@ -594,11 +601,12 @@ static int menu_search (MUTTMENU *menu, int op) mutt_error ("No search pattern."); return (-1); } - - if (op == OP_SEARCH_OPPOSITE) - searchDir = -searchDir; } + searchDir = (menu->searchDir == M_SEARCH_UP) ? -1 : 1; + if (op == OP_SEARCH_OPPOSITE) + searchDir = -searchDir; + if ((r = REGCOMP (&re, menu->searchBuf, REG_NOSUB | mutt_which_case (menu->searchBuf))) != 0) { regerror (r, &re, buf, sizeof (buf)); |