* 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 <alpha@debian.org>
This commit is contained in:
Andrew V. Samoilov 2003-03-21 16:01:50 +00:00
parent 222058978d
commit 9d9dd380fb
2 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2003-03-21 Andrew V. Samoilov <sav@bcs.zp.ua>
* 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 <alpha@debian.org>
2003-03-19 Andrew V. Samoilov <sav@bcs.zp.ua>
* view.c (icase_search_p): Add backward search support.

View File

@ -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;
}