diff options
Diffstat (limited to 'alpine/backwards-search.patch')
-rw-r--r-- | alpine/backwards-search.patch | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/alpine/backwards-search.patch b/alpine/backwards-search.patch deleted file mode 100644 index 89266097..00000000 --- a/alpine/backwards-search.patch +++ /dev/null @@ -1,93 +0,0 @@ -diff --git a/alpine/mailindx.c b/alpine/mailindx.c -index 18583c3..f1dd874 100644 ---- a/alpine/mailindx.c -+++ b/alpine/mailindx.c -@@ -2954,19 +2954,21 @@ away. - void - index_search(struct pine *state, MAILSTREAM *stream, int command_line, MSGNO_S *msgmap) - { -- int rc, select_all = 0, flags, prefetch, we_turned_on = 0; -+ int rc, select_all = 0, flags, prefetch, searchbound, otherbound, offset = 0, we_turned_on = 0; - long i, sorted_msg, selected = 0L; - char prompt[MAX_SEARCH+50], new_string[MAX_SEARCH+1]; - char buf[MAX_SCREEN_COLS+1], *p; - HelpType help; - char search_string[MAX_SEARCH+1]; - ICE_S *ice, *ic; -+ static int direction = 1; - static HISTORY_S *history = NULL; - static ESCKEY_S header_search_key[] = { {0, 0, NULL, NULL }, - {ctrl('Y'), 10, "^Y", N_("First Msg")}, - {ctrl('V'), 11, "^V", N_("Last Msg")}, - {KEY_UP, 30, "", ""}, - {KEY_DOWN, 31, "", ""}, -+ {ctrl('W'), 32, "^W", N_("Direction")}, - {-1, 0, NULL, NULL} }; - #define KU_IS (3) /* index of KEY_UP */ - #define PREFETCH_THIS_MANY_LINES (50) -@@ -2995,7 +2997,8 @@ index_search(struct pine *state, MAILSTREAM *stream, int command_line, MSGNO_S * - new_string[0] = '\0'; - - while(1) { -- snprintf(prompt, sizeof(prompt), _("Word to search for [%s] : "), search_string); -+ snprintf(prompt, sizeof(prompt), _("Word to search %sfor [%s] : "), -+ direction == -1 ? _("(backwards) ") : "", search_string); - - if(F_ON(F_ENABLE_AGG_OPS, ps_global)){ - header_search_key[0].ch = ctrl('X'); -@@ -3092,6 +3095,10 @@ index_search(struct pine *state, MAILSTREAM *stream, int command_line, MSGNO_S * - - continue; - } -+ else if(rc == 32){ -+ direction *= -1; -+ continue; -+ } - - if(rc != 4){ /* 4 is redraw */ - save_hist(history, new_string, 0, NULL); -@@ -3115,9 +3122,18 @@ index_search(struct pine *state, MAILSTREAM *stream, int command_line, MSGNO_S * - we_turned_on = intr_handling_on(); - - prefetch = 0; -- for(i = sorted_msg + ((select_all)?0:1); -- i <= mn_get_total(msgmap) && !ps_global->intr_pending; -- i++){ -+ if (direction == -1) { -+ searchbound = -1; -+ otherbound = mn_get_total(msgmap); -+ offset = 2; -+ } else { -+ searchbound = mn_get_total(msgmap); -+ otherbound = 1; -+ } -+ -+ for(i = sorted_msg + ((select_all)?0:1) - offset; -+ i * direction <= searchbound && !ps_global->intr_pending; -+ i += direction){ - if(msgline_hidden(stream, msgmap, i, 0)) - continue; - -@@ -3139,8 +3155,11 @@ index_search(struct pine *state, MAILSTREAM *stream, int command_line, MSGNO_S * - } - - prefetch = 0; -- if(i > mn_get_total(msgmap)){ -- for(i = 1; i < sorted_msg && !ps_global->intr_pending; i++){ -+ if(i * direction > searchbound){ -+ for(i = otherbound; -+ i * direction < sorted_msg * direction && !ps_global->intr_pending; -+ i += direction ){ -+ - if(msgline_hidden(stream, msgmap, i, 0)) - continue; - -@@ -3194,7 +3213,7 @@ index_search(struct pine *state, MAILSTREAM *stream, int command_line, MSGNO_S * - } - else if(selected){ - q_status_message1(SM_ORDER, 0, 3, _("Word found%s"), -- (i < sorted_msg) ? _(". Search wrapped to beginning") : -+ (i * direction < sorted_msg * direction) ? _(". Search wrapped to beginning") : - (i == sorted_msg) ? _(". Current line contains only match") : ""); - mn_set_cur(msgmap, i); - } |