cairo: always have space for < at single line mode

This commit is contained in:
Jari Vetoniemi 2020-02-07 18:19:56 +02:00
parent 42eca37688
commit c4856d784b

View File

@ -324,13 +324,10 @@ 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);
if (menu->wrap || menu->index > 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, "<");
cl += result.x_advance + 1;
}
paint.pos = (struct pos){ cl, vpadding };
paint.box = (struct box){ 1, 2, vpadding, vpadding, 0, ascii_height };
bm_cairo_draw_line(cairo, &paint, &result, ((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));