From cd825ac735303393f2b36bfcd3dc99e1cf93b1db Mon Sep 17 00:00:00 2001 From: Richard Hitt Date: Wed, 18 Sep 2013 15:25:50 -0700 Subject: Improve text repositioning when searchbar string is modified. --- src/fe-gtk/xtext.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/fe-gtk/xtext.h') diff --git a/src/fe-gtk/xtext.h b/src/fe-gtk/xtext.h index 446708be..32e26af6 100644 --- a/src/fe-gtk/xtext.h +++ b/src/fe-gtk/xtext.h @@ -64,6 +64,20 @@ typedef struct _GtkXText GtkXText; typedef struct _GtkXTextClass GtkXTextClass; typedef struct textentry textentry; +/* + * offsets_t is used for retaining search information. + * It is stored in the 'data' member of a GList, + * as chained from ent->marks. It saves starting and + * ending+1 offset of a found occurrence. + */ +typedef union offsets_u { + struct offsets_s { + guint16 start; + guint16 end; + } o; + guint32 u; +} offsets_t; + typedef struct { GtkXText *xtext; /* attached to this widget */ @@ -105,6 +119,7 @@ typedef struct { gtk_xtext_search_flags search_flags; /* match, bwd, highlight */ GList *cursearch; /* GList whose 'data' pts to current textentry */ GList *curmark; /* current item in ent->marks */ + offsets_t curdata; /* current offset info, from *curmark */ GRegex *search_re; /* Compiled regular expression */ textentry *hintsearch; /* textentry found for last search */ } xtext_buffer; -- cgit 1.4.1