[poppler] glib/poppler-page.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sun Mar 24 04:58:16 PDT 2013


 glib/poppler-page.cc |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 4ee6757dd7de9211faf8601531342a199225a06d
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sun Mar 24 12:53:29 2013 +0100

    glib: Always start from the beginning when starting a new search on a page
    
    And start from previous match when searching the next one on the same
    page. This allows to search for the same string multiple times on the
    same page.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=59972

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index b88c70b..631edb5 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -877,6 +877,7 @@ poppler_page_find_text_with_options (PopplerPage     *page,
   double height;
   TextPage *text_dev;
   gboolean backwards;
+  gboolean start_at_last = FALSE;
 
   g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
   g_return_val_if_fail (text != NULL, NULL);
@@ -893,7 +894,8 @@ poppler_page_find_text_with_options (PopplerPage     *page,
 
   while (text_dev->findText (ucs4, ucs4_len,
                              gFalse, gTrue, // startAtTop, stopAtBottom
-                             gTrue, gFalse, // startAtLast, stopAtLast
+                             start_at_last,
+                             gFalse, //stopAtLast
                              options & POPPLER_FIND_CASE_SENSITIVE,
                              backwards,
                              options & POPPLER_FIND_WHOLE_WORDS_ONLY,
@@ -905,6 +907,7 @@ poppler_page_find_text_with_options (PopplerPage     *page,
       match->x2 = xMax;
       match->y2 = height - yMin;
       matches = g_list_prepend (matches, match);
+      start_at_last = TRUE;
     }
 
   g_free (ucs4);


More information about the poppler mailing list