diff options
author | V.Barkov <[email protected]> | 2016-11-24 20:18:27 +0300 |
---|---|---|
committer | V.Barkov <[email protected]> | 2016-11-24 20:18:27 +0300 |
commit | 2314b3828cbe540d65ba517c32872476417501a6 (patch) | |
tree | 389ad57d86d0c3b1ecd6498e7327cbc05ebfbd7e /pluma/pluma-utils.c | |
parent | 9f79aa764fa8b31b204f79ca452502204bbfa09d (diff) | |
download | pluma-2314b3828cbe540d65ba517c32872476417501a6.tar.bz2 pluma-2314b3828cbe540d65ba517c32872476417501a6.tar.xz |
Fixed formatting [2]
Diffstat (limited to 'pluma/pluma-utils.c')
-rw-r--r-- | pluma/pluma-utils.c | 180 |
1 files changed, 90 insertions, 90 deletions
diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c index a5f67a2c..868a5bd8 100644 --- a/pluma/pluma-utils.c +++ b/pluma/pluma-utils.c @@ -1574,95 +1574,95 @@ pluma_utils_decode_uri (const gchar *uri, gboolean pluma_gtk_text_iter_regex_search (const GtkTextIter *iter, - const gchar *str, - GtkTextSearchFlags flags, - GtkTextIter *match_start, - GtkTextIter *match_end, - const GtkTextIter *limit, - gboolean forward_search) + const gchar *str, + GtkTextSearchFlags flags, + GtkTextIter *match_start, + GtkTextIter *match_end, + const GtkTextIter *limit, + gboolean forward_search) { - GRegex *regex; - GRegexCompileFlags compile_flags; - GMatchInfo *match_info; - gchar *text; - GtkTextIter *begin_iter; - GtkTextIter *end_iter; - gchar **all_matches; - gchar *match_string; - gboolean found; - - compile_flags = 0; - if ((flags & GTK_TEXT_SEARCH_CASE_INSENSITIVE) != 0) - compile_flags |= G_REGEX_CASELESS; - - regex = g_regex_new (str,compile_flags,0,NULL); - if (regex == NULL) - return FALSE; - - begin_iter=gtk_text_iter_copy(iter); - if (limit == NULL) - { - end_iter=gtk_text_iter_copy(begin_iter); - if(forward_search) - { - gtk_text_buffer_get_end_iter(gtk_text_iter_get_buffer(begin_iter), - end_iter); - } - else - { - gtk_text_buffer_get_start_iter(gtk_text_iter_get_buffer(begin_iter), - end_iter); - } - } - else - { - end_iter=gtk_text_iter_copy(limit); - } - - if ((flags & GTK_TEXT_SEARCH_TEXT_ONLY) != 0) - { - if ((flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0) - text=gtk_text_iter_get_visible_text(begin_iter,end_iter); - else - text=gtk_text_iter_get_text(begin_iter,end_iter); - } - else - { - if ((flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0) - text=gtk_text_iter_get_visible_slice(begin_iter,end_iter); - else - text=gtk_text_iter_get_slice(begin_iter,end_iter); - } - - found = g_regex_match_all(regex,text,0,&match_info); - if (found) - { - all_matches=g_match_info_fetch_all(match_info); - if(forward_search) - { - match_string=all_matches[0]; - gtk_text_iter_forward_search(begin_iter - ,match_string - ,flags - ,match_start - ,match_end - ,limit); - } - else - { - match_string=all_matches[g_strv_length(all_matches)-1]; - gtk_text_iter_backward_search(begin_iter - ,match_string - ,flags - ,match_start - ,match_end - ,limit); - } - } - - gtk_text_iter_free(begin_iter); - gtk_text_iter_free(end_iter); - g_match_info_free (match_info); - g_regex_unref (regex); - return found; + GRegex *regex; + GRegexCompileFlags compile_flags; + GMatchInfo *match_info; + gchar *text; + GtkTextIter *begin_iter; + GtkTextIter *end_iter; + gchar **all_matches; + gchar *match_string; + gboolean found; + + compile_flags = 0; + if ((flags & GTK_TEXT_SEARCH_CASE_INSENSITIVE) != 0) + compile_flags |= G_REGEX_CASELESS; + + regex = g_regex_new (str,compile_flags,0,NULL); + if (regex == NULL) + return FALSE; + + begin_iter=gtk_text_iter_copy(iter); + if (limit == NULL) + { + end_iter=gtk_text_iter_copy(begin_iter); + if(forward_search) + { + gtk_text_buffer_get_end_iter(gtk_text_iter_get_buffer(begin_iter), + end_iter); + } + else + { + gtk_text_buffer_get_start_iter(gtk_text_iter_get_buffer(begin_iter), + end_iter); + } + } + else + { + end_iter=gtk_text_iter_copy(limit); + } + + if ((flags & GTK_TEXT_SEARCH_TEXT_ONLY) != 0) + { + if ((flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0) + text=gtk_text_iter_get_visible_text(begin_iter,end_iter); + else + text=gtk_text_iter_get_text(begin_iter,end_iter); + } + else + { + if ((flags & GTK_TEXT_SEARCH_VISIBLE_ONLY) != 0) + text=gtk_text_iter_get_visible_slice(begin_iter,end_iter); + else + text=gtk_text_iter_get_slice(begin_iter,end_iter); + } + + found = g_regex_match_all(regex,text,0,&match_info); + if (found) + { + all_matches=g_match_info_fetch_all(match_info); + if(forward_search) + { + match_string=all_matches[0]; + gtk_text_iter_forward_search(begin_iter, + match_string, + flags, + match_start, + match_end, + limit); + } + else + { + match_string=all_matches[g_strv_length(all_matches)-1]; + gtk_text_iter_backward_search(begin_iter, + match_string, + flags, + match_start, + match_end, + limit); + } + } + + gtk_text_iter_free(begin_iter); + gtk_text_iter_free(end_iter); + g_match_info_free (match_info); + g_regex_unref (regex); + return found; } |