diff options
author | Erich Eckner <git@eckner.net> | 2019-03-25 10:01:11 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-03-25 10:01:11 +0100 |
commit | c4d5cf7cbda36a84bd34d0bb410f39b9e008faa2 (patch) | |
tree | 1156cf0d8fcf9670f229e1a527fef5ae7c6df5b6 | |
parent | 29280c3155bc6780caeab58034997acc50b39fb6 (diff) | |
download | archlinuxewe-c4d5cf7cbda36a84bd34d0bb410f39b9e008faa2.tar.xz |
alpine: backwards-search.patch new
-rw-r--r-- | alpine/PKGBUILD | 9 | ||||
-rw-r--r-- | alpine/backwards-search.patch | 93 |
2 files changed, 98 insertions, 4 deletions
diff --git a/alpine/PKGBUILD b/alpine/PKGBUILD index 0cfc215bc..767ff48f6 100644 --- a/alpine/PKGBUILD +++ b/alpine/PKGBUILD @@ -1,12 +1,10 @@ -# -*- shell-script -*- -# # Maintainer: Erich Eckner <arch at eckner dot net> # Contributor: Adrian C. <anrxc..sysphere.org> pkgname=alpine pkgver=2.21.9999.r45.0707eb6 _commit=${pkgver##*.} -pkgrel='2' +pkgrel='3' arch=("i686" "x86_64") pkgdesc="Apache licensed PINE mail user agent" url="http://alpine.freeiz.com" @@ -23,13 +21,16 @@ options=("!makeflags") source=( "alpine::git://repo.or.cz/alpine.git#commit=${_commit}" 'topal-patch.patch' + 'backwards-search.patch' # thanks, Astyanax Foo - http://mailman13.u.washington.edu/pipermail/alpine-info/2009-February/001753.html ) sha512sums=('SKIP' - 'bc7a3143cb2f7d79438c49b89bfdc52db7473521a7870ad621ecba96fff2f1688f4f3d58def9b8d57f8beba4e1e9c8b193f9281571e0564538ca7c7db16f0027') + 'bc7a3143cb2f7d79438c49b89bfdc52db7473521a7870ad621ecba96fff2f1688f4f3d58def9b8d57f8beba4e1e9c8b193f9281571e0564538ca7c7db16f0027' + 'c4ebb6ace5c2520e74ed28eea730d34d4dea68b7ae3ac67966e5cc4db0a5731de748f8f11137115cc2a5d4b7278e10fa450d0b4b04956e53402f1d92fae2d7d6') prepare() { cd "${srcdir}/${pkgname}" patch -p1 -i "${srcdir}/topal-patch.patch" + patch -p1 -i "${srcdir}/backwards-search.patch" } pkgver() { diff --git a/alpine/backwards-search.patch b/alpine/backwards-search.patch new file mode 100644 index 000000000..892660976 --- /dev/null +++ b/alpine/backwards-search.patch @@ -0,0 +1,93 @@ +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); + } |