forked from RepoMirrors/bemenu
cairo: don't draw left scroll indicator if empty
If there are no matches the left indicator would be still drawn as black box. If filter string is long enough, this black box would cover part of the filter string.
This commit is contained in:
parent
116cb5479f
commit
d9f4d1bb12
@ -339,10 +339,13 @@ bm_cairo_paint(struct cairo *cairo, uint32_t width, uint32_t max_height, const s
|
||||
/* single-line mode */
|
||||
bm_pango_get_text_extents(cairo, &paint, &result, "lorem ipsum lorem ipsum lorem ipsum lorem");
|
||||
uint32_t cl = fmin(title_x + result.x_advance, width / 4);
|
||||
paint.pos = (struct pos){ cl, vpadding };
|
||||
paint.box = (struct box){ 1, 2, vpadding, vpadding, 0, ascii_height };
|
||||
bm_cairo_draw_line(cairo, &paint, &result, (count > 0 && (menu->wrap || menu->index > 0) ? "<" : " "));
|
||||
cl += result.x_advance + 1;
|
||||
|
||||
if (count > 0) {
|
||||
paint.pos = (struct pos){ cl, vpadding };
|
||||
paint.box = (struct box){ 1, 2, vpadding, vpadding, 0, ascii_height };
|
||||
bm_cairo_draw_line(cairo, &paint, &result, (count > 0 && (menu->wrap || menu->index > 0) ? "<" : " "));
|
||||
cl += result.x_advance + 1;
|
||||
}
|
||||
|
||||
for (uint32_t i = menu->index; i < count && cl < (width/cairo->scale); ++i) {
|
||||
bool highlighted = (items[i] == bm_menu_get_highlighted_item(menu));
|
||||
|
Loading…
Reference in New Issue
Block a user