mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-11 13:50:48 -05:00
view: Use \uFFFC character as icon placeholder
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
parent
43053cdfc3
commit
fb37aaa70d
1 changed files with 11 additions and 7 deletions
|
@ -906,15 +906,19 @@ static void update_callback ( textbox *t, unsigned int index, void *udata, TextB
|
|||
else{
|
||||
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 );
|
||||
textbox_icon ( t, icon );
|
||||
|
||||
//AA TODO: Find a better way to position icon than tab char
|
||||
gchar *firstspace = g_utf8_strchr ( t->text, -1, '\t' );
|
||||
textbox_set_icon_index ( t, ( firstspace == NULL ) ? -1 : g_utf8_pointer_to_offset ( t->text, firstspace ) + 1 );
|
||||
const gchar *visible_text = textbox_get_visible_text ( t );
|
||||
const gchar *icon_placeholder = g_utf8_strchr ( visible_text, -1, 0xFFFC );
|
||||
if ( icon_placeholder != NULL ) {
|
||||
cairo_surface_t *icon = mode_get_icon ( state->sw, state->line_map[index], icon_height );
|
||||
textbox_icon ( t, icon );
|
||||
|
||||
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 ) {
|
||||
ThemeHighlight th = { HL_BOLD | HL_UNDERLINE, { 0.0, 0.0, 0.0, 0.0 } };
|
||||
th = rofi_theme_get_highlight ( WIDGET ( t ), "highlight", th );
|
||||
|
|
Loading…
Reference in a new issue