summaryrefslogtreecommitdiffstats
path: root/source/view.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-05-10 18:02:23 +0200
committerDave Davenport <qball@gmpclient.org>2016-05-10 18:02:23 +0200
commitc8a6b266079ff25bfb979641e1a1101ca5a32258 (patch)
treeb32ca599809cb766579a316f66b4bdbfb570e582 /source/view.c
parent09437e3f0e22a0819cd841635f572dab88e644ad (diff)
First try at highlighting match (regex only)
Diffstat (limited to 'source/view.c')
-rw-r--r--source/view.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/view.c b/source/view.c
index 320a5db2..de9b00cf 100644
--- a/source/view.c
+++ b/source/view.c
@@ -933,6 +933,7 @@ static void rofi_view_draw ( RofiViewState *state, cairo_t *d )
int x_offset = state->border;
if ( state->rchanged ) {
+ char **tokens = tokenize ( state->text->text, config.case_sensitive );
// Move, resize visible boxes and show them.
for ( i = 0; i < max_elements && ( i + offset ) < state->filtered_lines; i++ ) {
unsigned int ex = ( ( i ) / state->max_rows ) * ( element_width + config.line_margin );
@@ -946,10 +947,19 @@ static void rofi_view_draw ( RofiViewState *state, cairo_t *d )
TextBoxFontType tbft = fstate | ( ( i + offset ) == state->selected ? HIGHLIGHT : type );
textbox_font ( state->boxes[i], tbft );
textbox_text ( state->boxes[i], text );
+
+ PangoAttrList *list = textbox_get_pango_attributes ( state->boxes[i] );
+ if ( list != NULL )
+ pango_attr_list_ref ( list );
+ else list = pango_attr_list_new ();
+ regex_token_match_get_pango_attr ( tokens, textbox_get_visible_text ( state->boxes[i] ), list );
+ textbox_set_pango_attributes ( state->boxes[i], list );
+ pango_attr_list_unref ( list );
g_free ( text );
}
textbox_draw ( state->boxes[i], d );
}
+ tokenize_free ( tokens );
state->rchanged = FALSE;
}
else{