[ghex/expand-search-options] Semi-fix next-match jump calcs for regex



commit 28ac38bf8f105861f3513b6394844ade9ba2cc7b
Author: Logan Rathbone <poprocks gmail com>
Date:   Tue Apr 19 00:04:46 2022 -0400

    Semi-fix next-match jump calcs for regex

 src/findreplace.c | 2 +-
 src/gtkhex.c      | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/findreplace.c b/src/findreplace.c
index 2f169da..41d4536 100644
--- a/src/findreplace.c
+++ b/src/findreplace.c
@@ -340,7 +340,7 @@ find_common (FindDialog *self, enum FindDirection direction,
        {
                find_data->start = f_priv->found == FALSE ?
                                                                cursor_pos :
-                                                               cursor_pos + f_priv->last_found_len;
+                                                               cursor_pos + f_priv->last_found_len - 1;
 
                hex_document_find_forward_full_async (doc,
                                find_data,
diff --git a/src/gtkhex.c b/src/gtkhex.c
index ade8e8b..03dfc2b 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -2144,13 +2144,14 @@ hex_widget_update_auto_highlight (HexWidget *self, HexWidgetAutoHighlight *ahl,
                           ahl->search_string,
                           ahl->search_len,
                           ahl->search_flags,
-                          /* lower */ MAX(add_min, foundpos+1),
-                          /* upper */ add_max,
+                          MAX(add_min, foundpos+1),    /* lower */
+                          add_max,                                             /* upper */
                           &foundpos,
                           &found_len))
        {
                hex_widget_insert_highlight (self, ahl,
-                               foundpos, foundpos + found_len - 1);
+                               foundpos,
+                               foundpos + found_len - 1);
        }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]