From 9d9dd380fb9699d71dabfb26593cdf290fb95ccf Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Fri, 21 Mar 2003 16:01:50 +0000 Subject: [PATCH] * view.c (get_line_at): Return unreversed line for backward search to restore backward regexp search feature. (icase_search_p): Fix for the above. Reported by Adam Byrtek --- src/ChangeLog | 7 +++++++ src/view.c | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 924d9ca82..ea83cbfda 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2003-03-21 Andrew V. Samoilov + + * view.c (get_line_at): Return unreversed line for backward + search to restore backward regexp search feature. + (icase_search_p): Fix for the above. + Reported by Adam Byrtek + 2003-03-19 Andrew V. Samoilov * view.c (icase_search_p): Add backward search support. diff --git a/src/view.c b/src/view.c index a64bf5ce1..ee0ed1a79 100644 --- a/src/view.c +++ b/src/view.c @@ -1484,13 +1484,17 @@ icase_search_p (WView *view, char *text, char *data, int nothing) int direction = view->direction; /* If we are searching backwards, reverse the string */ - if (direction == -1) + if (direction == -1) { g_strreverse (text); + g_strreverse (data); + } q = _icase_search (text, data, &lng); - if (direction == -1) + if (direction == -1) { g_strreverse (text); + g_strreverse (data); + } if (q != 0) { if (direction > 0) @@ -1569,6 +1573,11 @@ get_line_at (WView *view, unsigned long *p, unsigned long *skipped) if (buffer) { buffer[0] = prev; buffer[i] = 0; + + /* If we are searching backwards, reverse the string */ + if (direction < 0) { + g_strreverse (buffer + 1); + } } *p = pos; @@ -1727,7 +1736,6 @@ block_search (WView *view, char *buffer, int len) update_activate = 0; if (direction == -1) { - for (d += len - 1;; e--) { if (e <= update_activate) { update_activate -= update_steps; @@ -1753,7 +1761,7 @@ block_search (WView *view, char *buffer, int len) if (e == 0) break; } - } else + } else { while (e < view->last_byte) { if (e >= update_activate) { update_activate += update_steps; @@ -1777,6 +1785,7 @@ block_search (WView *view, char *buffer, int len) d = buffer; } } + } disable_interrupt_key (); return -1; }