summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-10-24 18:43:01 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-10-24 18:45:58 +0200
commit023555b706ce870769a6e2c924e95480ea5f19d1 (patch)
tree43c8696837f57223cc83cfd6c526bacfbb0364a2 /source/fitz
parentfbc45bbc784f7be294eb29b1fbae896e706571d5 (diff)
downloadmupdf-023555b706ce870769a6e2c924e95480ea5f19d1.tar.xz
Don't return overlapping search results.
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/stext-search.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/fitz/stext-search.c b/source/fitz/stext-search.c
index 46c9166b..bba2c3f5 100644
--- a/source/fitz/stext-search.c
+++ b/source/fitz/stext-search.c
@@ -135,7 +135,8 @@ fz_search_stext_page(fz_context *ctx, fz_stext_page *text, const char *needle, f
hit_count = 0;
len = textlen_stext(ctx, text);
- for (pos = 0; pos < len; pos++)
+ pos = 0;
+ while (pos < len)
{
n = match_stext(ctx, text, needle, pos);
if (n)
@@ -161,6 +162,11 @@ fz_search_stext_page(fz_context *ctx, fz_stext_page *text, const char *needle, f
}
if (!fz_is_empty_rect(&linebox) && hit_count < hit_max)
hit_bbox[hit_count++] = linebox;
+ pos += n;
+ }
+ else
+ {
+ pos += 1;
}
}