From 9ba2e0f52f45925e3da95f0c180362aae7c407d1 Mon Sep 17 00:00:00 2001 From: speedie Date: Sun, 18 Jun 2023 21:15:32 +0200 Subject: [PATCH] Add powerline for !lines as well --- libs/draw.c | 6 +++--- spmenu.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/draw.c b/libs/draw.c index 28f2163..145ca1a 100644 --- a/libs/draw.c +++ b/libs/draw.c @@ -116,7 +116,7 @@ int drawitemtext(struct item *item, int x, int y, int w) { fga = itemn ? alpha_itemnormfg2 : alpha_itemnormfg; } - if (!hidepowerline && powerlineitems && selitem && lines > 0) { + if (!hidepowerline && powerlineitems && selitem) { if (itempwlstyle == 2) { drw_circle(drw, x - plw, y, plw, bh, 0, col_menu, bgcol, alpha_menu, bga); } else { @@ -262,7 +262,7 @@ int drawitemtext(struct item *item, int x, int y, int w) { item->clntext = malloc(sizeof(buffer)); memcpy(item->clntext, buffer, sizeof(buffer)); - if (!hidepowerline && powerlineitems && selitem && lines > 0) { + if (!hidepowerline && powerlineitems && selitem) { if (itempwlstyle == 2) { drw_circle(drw, r, y, plw, bh, 1, col_menu, bgcol, alpha_menu, bga); } else { @@ -347,7 +347,7 @@ int drawitem(int x, int y, int w) { int itemoverride = 1; for (item = curr; item != next; item = item->right) { // draw items - x = drawitemtext(item, x, y, MIN(pango_item ? TEXTWM(item->text) : TEXTW(item->text), + x = drawitemtext(item, x + (powerlineitems ? plw : 0), y, MIN(pango_item ? TEXTWM(item->text) : TEXTW(item->text), mw - x - rarrowWidth - numberWidth - diff --git a/spmenu.c b/spmenu.c index e602cae..38fb038 100644 --- a/spmenu.c +++ b/spmenu.c @@ -342,12 +342,12 @@ void calcoffsets(void) { // calculate which items will begin the next page for (i = 0, next = curr; next; next = next->right) - if ((i += (lines > 0) ? bh : MIN(TEXTWM(next->text), n)) > n) + if ((i += (lines > 0) ? bh : MIN(TEXTWM(next->text) + (powerlineitems ? !lines ? 2 * plw : 0 : 0), n)) > n) break; // calculate which items will begin the previous page for (i = 0, prev = curr; prev && prev->left; prev = prev->left) - if ((i += (lines > 0) ? bh : MIN(TEXTWM(prev->left->text), n)) > n) + if ((i += (lines > 0) ? bh : MIN(TEXTWM(prev->left->text) + (powerlineitems ? !lines ? 2 * plw : 0 : 0), n)) > n) break; }