summaryrefslogtreecommitdiff
path: root/fitz/text_search.c
diff options
context:
space:
mode:
Diffstat (limited to 'fitz/text_search.c')
-rw-r--r--fitz/text_search.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fitz/text_search.c b/fitz/text_search.c
index 6631535b..9b0a3acf 100644
--- a/fitz/text_search.c
+++ b/fitz/text_search.c
@@ -103,9 +103,16 @@ static int match(fz_text_page *page, const char *s, int n)
s += fz_chartorune(&c, (char *)s);
if (iswhite(c) && iswhite(charat(page, n)))
{
+ const char *s_next;
+
+ /* Skip over whitespace in the document */
do
n++;
while (iswhite(charat(page, n)));
+
+ /* Skip over multiple whitespace in the search string */
+ while (s_next = s + fz_chartorune(&c, (char *)s), iswhite(c))
+ s = s_next;
}
else
{
@@ -118,7 +125,7 @@ static int match(fz_text_page *page, const char *s, int n)
}
int
-fz_search_text_page(fz_context *ctx, fz_text_page *text, char *needle, fz_rect *hit_bbox, int hit_max)
+fz_search_text_page(fz_context *ctx, fz_text_page *text, const char *needle, fz_rect *hit_bbox, int hit_max)
{
int pos, len, i, n, hit_count;