commit 0c227f074ddb36172f5bcd9b202cf095cd8c8290
parent de39a9444f03672a980255e1ef67259adc6a2401
Author: ukai <ukai>
Date: Thu, 30 Jan 2003 16:26:15 +0000
[w3m-dev 03713] search with "$"
* search.c (forwardSearch): check l->next && l->next->bpos
(backwardSearch): check l->size, l->next && l->next->bpos
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,11 @@
2003-01-31 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03713] search with "$"
+ * search.c (forwardSearch): check l->next && l->next->bpos
+ (backwardSearch): check l->size, l->next && l->next->bpos
+
+2003-01-31 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03712] buf fix of LINE_INFO
* main.c (curlno): rewrite
diff --git a/search.c b/search.c
@@ -121,7 +121,7 @@ forwardSearch(Buffer *buf, char *str)
if (pos < l->size && regexMatch(&l->lineBuf[pos], l->size - pos, 0) == 1) {
matchedPosition(&first, &last);
pos = first - l->lineBuf;
- while (pos >= l->len) {
+ while (pos >= l->len && l->next && l->next->bpos) {
pos -= l->len;
l = l->next;
}
@@ -162,7 +162,7 @@ forwardSearch(Buffer *buf, char *str)
/* exactly same match */
break;
pos = first - l->lineBuf;
- while (pos >= l->len) {
+ while (pos >= l->len && l->next && l->next->bpos) {
pos -= l->len;
l = l->next;
}
@@ -228,6 +228,8 @@ backwardSearch(Buffer *buf, char *str)
found = first;
found_last = last;
}
+ if (q - l->lineBuf >= l->size)
+ break;
#ifdef JP_CHARSET
if (l->propBuf[q - l->lineBuf] & PC_KANJI1)
q += 2;
@@ -239,7 +241,7 @@ backwardSearch(Buffer *buf, char *str)
}
if (found) {
pos = found - l->lineBuf;
- while (pos >= l->len) {
+ while (pos >= l->len && l->next && l->next->bpos) {
pos -= l->len;
l = l->next;
}
@@ -273,6 +275,8 @@ backwardSearch(Buffer *buf, char *str)
found = first;
found_last = last;
}
+ if (q - l->lineBuf >= l->size)
+ break;
#ifdef JP_CHARSET
if (l->propBuf[q - l->lineBuf] & PC_KANJI1)
q += 2;
@@ -282,7 +286,7 @@ backwardSearch(Buffer *buf, char *str)
}
if (found) {
pos = found - l->lineBuf;
- while (pos >= l->len) {
+ while (pos >= l->len && l->next && l->next->bpos) {
pos -= l->len;
l = l->next;
}