From bc1c177cf932491f8843220becfa9246da750ca0 Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Sun, 8 Apr 2007 14:26:24 -0500 Subject: [PATCH] Fixed searching with VISIBLE_ONLY --- moo.kdevelop | 24 ++++++------- .../gtksourceview/upstream/gtksourceiter.c | 34 +++++++++++++++---- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/moo.kdevelop b/moo.kdevelop index 47c1fdf7..2193fceb 100644 --- a/moo.kdevelop +++ b/moo.kdevelop @@ -26,7 +26,7 @@ . false - + C @@ -35,7 +35,7 @@ moo/libmoo.la - debug + gtk-cvs medit/medit @@ -246,10 +246,10 @@ true false true - - - - + + + + true @@ -311,16 +311,16 @@ - + A new empty GAP source file - + A new empty C++ file. - + A new empty header file for C/C++. - + A new empty C file. @@ -347,7 +347,7 @@ - + set m_,_ theValue @@ -357,7 +357,7 @@ false 3 - + diff --git a/moo/mooedit/gtksourceview/upstream/gtksourceiter.c b/moo/mooedit/gtksourceview/upstream/gtksourceiter.c index d076d608..fa7d1f73 100644 --- a/moo/mooedit/gtksourceview/upstream/gtksourceiter.c +++ b/moo/mooedit/gtksourceview/upstream/gtksourceiter.c @@ -227,6 +227,25 @@ finally_2: return ret; } +/* FIXME: total horror */ +static gboolean +char_is_invisible (const GtkTextIter *iter) +{ + GSList *tags; + gboolean invisible = FALSE; + tags = gtk_text_iter_get_tags (iter); + while (tags) + { + gboolean this_invisible, invisible_set; + g_object_get (tags->data, "invisible", &this_invisible, + "invisible-set", &invisible_set, NULL); + if (invisible_set) + invisible = this_invisible; + tags = g_slist_delete_link (tags, tags); + } + return invisible; +} + static void forward_chars_with_skipping (GtkTextIter *iter, gint count, @@ -253,8 +272,9 @@ forward_chars_with_skipping (GtkTextIter *iter, if (skip_nontext && gtk_text_iter_get_char (iter) == GTK_TEXT_UNKNOWN_CHAR) ignored = TRUE; - if (!ignored && skip_invisible && - /* _gtk_text_btree_char_is_invisible (iter)*/ FALSE) + /* FIXME: char_is_invisible() gets list of tags for each char there, + and checks every tag. It doesn't sound like a good idea. */ + if (!ignored && skip_invisible && char_is_invisible (iter)) ignored = TRUE; if (!ignored && skip_decomp) @@ -476,9 +496,9 @@ backward_lines_match (const GtkTextIter *start, /* strsplit () that retains the delimiter as part of the string. */ static gchar ** -strbreakup (const char *string, - const char *delimiter, - gint max_tokens) +breakup_string (const char *string, + const char *delimiter, + gint max_tokens) { GSList *string_list = NULL, *slist; gchar **str_array, *s, *casefold, *new_string; @@ -619,7 +639,7 @@ gtk_source_iter_forward_search (const GtkTextIter *iter, slice = (flags & GTK_SOURCE_SEARCH_TEXT_ONLY) == 0; /* locate all lines */ - lines = strbreakup (str, "\n", -1); + lines = breakup_string (str, "\n", -1); search = *iter; @@ -722,7 +742,7 @@ gtk_source_iter_backward_search (const GtkTextIter *iter, slice = (flags & GTK_SOURCE_SEARCH_TEXT_ONLY) == 0; /* locate all lines */ - lines = strbreakup (str, "\n", -1); + lines = breakup_string (str, "\n", -1); search = *iter;