--- a/pidgin/pidgindebug.c Wed Jun 13 02:00:58 2018 -0400
+++ b/pidgin/pidgindebug.c Wed Jun 13 01:05:46 2018 -0400
@@ -52,8 +52,10 @@
GtkTextTag *level[PURPLE_DEBUG_FATAL + 1];
+ GtkTextTag *filtered_invisible; + GtkTextTag *filtered_visible; @@ -166,7 +168,7 @@
gtk_text_buffer_get_bounds(win->buffer, &start, &end);
- gtk_text_buffer_remove_tag(win->buffer, win->tags.invisible,
+ gtk_text_buffer_remove_tag(win->buffer, win->tags.paused, gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(win->textview),
win->end_mark, 0, TRUE, 0, 1);
@@ -197,36 +199,86 @@
+do_regex(PidginDebugWindow *win, GtkTextIter *start, GtkTextIter *end) + gint start_pos, end_pos; + GtkTextIter match_start, match_end; + initial_position = gtk_text_iter_get_offset(start); + /* First hide everything. */ + gtk_text_buffer_apply_tag(win->buffer, + win->tags.filtered_invisible, start, end); + text = gtk_text_buffer_get_text(win->buffer, start, end, TRUE); + g_regex_match(win->regex, text, 0, &match); + while (g_match_info_matches(match)) { + g_match_info_fetch_pos(match, 0, &start_pos, &end_pos); + start_pos += initial_position; + end_pos += initial_position; + /* Expand match to full line of message. */ + gtk_text_buffer_get_iter_at_offset(win->buffer, + &match_start, start_pos); + gtk_text_iter_set_line_index(&match_start, 0); + gtk_text_buffer_get_iter_at_offset(win->buffer, + gtk_text_iter_forward_line(&match_end); + gtk_text_buffer_apply_tag(win->buffer, + win->tags.filtered_invisible, + &match_start, &match_end); + /* Make visible again (with higher priority.) */ + gtk_text_buffer_apply_tag(win->buffer, + win->tags.filtered_visible, + &match_start, &match_end); + gtk_text_buffer_get_iter_at_offset( + gtk_text_buffer_get_iter_at_offset( + gtk_text_buffer_apply_tag(win->buffer, + g_match_info_next(match, &error); + g_match_info_free(match); regex_toggle_filter(PidginDebugWindow *win, gboolean filter)
gtk_text_buffer_get_bounds(win->buffer, &start, &end);
gtk_text_buffer_remove_tag(win->buffer, win->tags.match, &start, &end);
+ gtk_text_buffer_remove_tag(win->buffer, win->tags.filtered_invisible, + gtk_text_buffer_remove_tag(win->buffer, win->tags.filtered_visible,
- gint start_pos, end_pos;
- GtkTextIter match_start = start, match_end = start;
- text = gtk_text_buffer_get_text(win->buffer, &start, &end, TRUE);
- g_regex_match(win->regex, text, 0, &match);
- while (g_match_info_matches(match)) {
- g_match_info_fetch_pos(match, 0, &start_pos, &end_pos);
- gtk_text_iter_set_offset(&match_start, start_pos);
- gtk_text_iter_set_offset(&match_end, end_pos);
- gtk_text_buffer_apply_tag(win->buffer, win->tags.match,
- &match_start, &match_end);
- g_match_info_next(match, &error);
- g_match_info_free(match);
+ do_regex(win, &start, &end); @@ -468,7 +520,9 @@
gtk_widget_class_bind_template_child(
widget_class, PidginDebugWindow, tags.category);
gtk_widget_class_bind_template_child(
- widget_class, PidginDebugWindow, tags.invisible);
+ widget_class, PidginDebugWindow, tags.filtered_invisible); + gtk_widget_class_bind_template_child( + widget_class, PidginDebugWindow, tags.filtered_visible); gtk_widget_class_bind_template_child(
widget_class, PidginDebugWindow, tags.level[0]);
gtk_widget_class_bind_template_child(
@@ -482,6 +536,8 @@
gtk_widget_class_bind_template_child(
widget_class, PidginDebugWindow, tags.level[5]);
gtk_widget_class_bind_template_child(
+ widget_class, PidginDebugWindow, tags.paused); + gtk_widget_class_bind_template_child( widget_class, PidginDebugWindow, filter);
gtk_widget_class_bind_template_child(
widget_class, PidginDebugWindow, filterlevel);
@@ -818,7 +874,7 @@
- debug_win->paused ? debug_win->tags.invisible : NULL,
+ debug_win->paused ? debug_win->tags.paused : NULL, if (category && *category) {
@@ -829,7 +885,7 @@
debug_win->tags.category,
- debug_win->paused ? debug_win->tags.invisible : NULL,
+ debug_win->paused ? debug_win->tags.paused : NULL, gtk_text_buffer_insert_with_tags(
@@ -838,7 +894,7 @@
debug_win->tags.category,
- debug_win->paused ? debug_win->tags.invisible : NULL,
+ debug_win->paused ? debug_win->tags.paused : NULL, @@ -848,7 +904,7 @@
- debug_win->paused ? debug_win->tags.invisible : NULL,
+ debug_win->paused ? debug_win->tags.paused : NULL, gtk_text_buffer_insert_with_tags(
@@ -856,7 +912,7 @@
- debug_win->paused ? debug_win->tags.invisible : NULL,
+ debug_win->paused ? debug_win->tags.paused : NULL, --- a/pidgin/resources/Debug/debug.ui Wed Jun 13 02:00:58 2018 -0400
+++ b/pidgin/resources/Debug/debug.ui Wed Jun 13 01:05:46 2018 -0400
@@ -40,16 +40,26 @@
- <object class="GtkTextTag" id="tags.invisible">
+ <object class="GtkTextTag" id="tags.filtered_invisible"> <property name="invisible">True</property>
+ <object class="GtkTextTag" id="tags.filtered_visible"> + <property name="invisible">False</property> <object class="GtkTextTag" id="tags.match">
<property name="background_rgba">rgb(255,175,175)</property>
<property name="weight">700</property>
+ <object class="GtkTextTag" id="tags.paused"> + <property name="invisible">True</property> <object class="GtkTextBuffer" id="buffer">
<property name="tag_table">message-format</property>