1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-03 15:34:54 -05:00

view: Use \uFFFC character as icon placeholder

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Quentin Glidic 2017-05-30 18:41:42 +02:00
parent 43053cdfc3
commit fb37aaa70d
No known key found for this signature in database
GPG key ID: AC203F96E2C34BB7

View file

@ -906,15 +906,19 @@ static void update_callback ( textbox *t, unsigned int index, void *udata, TextB
else{ else{
list = pango_attr_list_new (); list = pango_attr_list_new ();
} }
int icon_height = textbox_get_font_height ( t ); int icon_height = textbox_get_font_height ( t );
cairo_surface_t *icon = mode_get_icon ( state->sw, state->line_map[index], icon_height ); const gchar *visible_text = textbox_get_visible_text ( t );
textbox_icon ( t, icon ); const gchar *icon_placeholder = g_utf8_strchr ( visible_text, -1, 0xFFFC );
if ( icon_placeholder != NULL ) {
//AA TODO: Find a better way to position icon than tab char cairo_surface_t *icon = mode_get_icon ( state->sw, state->line_map[index], icon_height );
gchar *firstspace = g_utf8_strchr ( t->text, -1, '\t' ); textbox_icon ( t, icon );
textbox_set_icon_index ( t, ( firstspace == NULL ) ? -1 : g_utf8_pointer_to_offset ( t->text, firstspace ) + 1 );
textbox_set_icon_index ( t, g_utf8_pointer_to_offset ( visible_text, icon_placeholder ) );
}
else {
textbox_set_icon_index ( t, -1 );
}
if ( state->tokens && config.show_match ) { if ( state->tokens && config.show_match ) {
ThemeHighlight th = { HL_BOLD | HL_UNDERLINE, { 0.0, 0.0, 0.0, 0.0 } }; ThemeHighlight th = { HL_BOLD | HL_UNDERLINE, { 0.0, 0.0, 0.0, 0.0 } };
th = rofi_theme_get_highlight ( WIDGET ( t ), "highlight", th ); th = rofi_theme_get_highlight ( WIDGET ( t ), "highlight", th );