diff --git a/libs/draw.c b/libs/draw.c index eb83d30..b861dd0 100644 --- a/libs/draw.c +++ b/libs/draw.c @@ -128,9 +128,9 @@ drawmenu(void) int rarrowWidth = 0; int itemWidth = 0; - if (!hidemode) modeWidth = TEXTW(modetext); - if (!hidelarrow) larrowWidth = TEXTW(leftarrow); - if (!hiderarrow) rarrowWidth = TEXTW(rightarrow); + if (!hidemode) modeWidth = pango_mode ? TEXTWM(modetext) : TEXTW(modetext); + if (!hidelarrow) larrowWidth = pango_leftarrow ? TEXTWM(leftarrow) : TEXTW(leftarrow); + if (!hiderarrow) rarrowWidth = pango_rightarrow ? TEXTWM(rightarrow) : TEXTW(rightarrow); if (prompt && *prompt) { if (colorprompt) { @@ -154,6 +154,7 @@ drawmenu(void) } else if (!passwd && !hideprompt) { apply_fribidi(text); drw_text(drw, x, 0, w, bh, lrpad / 2, isrtl ? fribidi_text : text, 0, pango_input ? True : False); + curpos = TEXTW(text) - TEXTW(&text[cursor]); } @@ -193,9 +194,9 @@ drawmenu(void) x += inputw; w = larrowWidth; - itemWidth = TEXTWM(item->text); + itemWidth = pango_item ? TEXTWM(item->text) : TEXTW(item->text); - if (curr->left) { + if (curr->left && !hidelarrow) { drw_setscheme(drw, scheme[SchemeLArrow]); drw_text(drw, x, 0, w, bh, lrpad / 2, leftarrow, 0, pango_leftarrow ? True : False); } @@ -205,7 +206,7 @@ drawmenu(void) for (item = curr; item != next; item = item->right) x = drawitem(item, x, 0, MIN(itemWidth, mw - x - rarrowWidth - numberWidth - modeWidth)); - if (next) { + if (next && !hiderarrow) { w = rarrowWidth; drw_setscheme(drw, scheme[SchemeRArrow]); diff --git a/options.h b/options.h index 78c4fb4..3a6e78e 100644 --- a/options.h +++ b/options.h @@ -137,6 +137,7 @@ static char col_sgrcolor13[] = "#ff00ff"; /* SGR color #13 */ static char col_sgrcolor14[] = "#00ffff"; /* SGR color #14 */ static char col_sgrcolor15[] = "#ffffff"; /* SGR color #15 */ +/* Pango options */ static int pango_item = 1; /* Enable support for pango markup for the items */ static int pango_highlight = 1; /* Enable support for pango markup for the highlighting */ static int pango_prompt = 1; /* Enable support for pango markup for the prompt */ diff --git a/spmenu.c b/spmenu.c index b3cbfb2..8a8665b 100644 --- a/spmenu.c +++ b/spmenu.c @@ -286,10 +286,10 @@ calcoffsets(void) int larrowWidth = 0; int rarrowWidth = 0; - if (!hidematchcount) numberWidth = TEXTW(numbers); - if (!hidemode) modeWidth = TEXTW(modetext); - if (!hidelarrow) larrowWidth = TEXTW(leftarrow); - if (!hiderarrow) rarrowWidth = TEXTW(rightarrow); + if (!hidematchcount) numberWidth = pango_numbers ? TEXTWM(numbers) : TEXTW(numbers); + if (!hidemode) modeWidth = pango_mode ? TEXTWM(modetext) : TEXTW(modetext); + if (!hidelarrow) larrowWidth = pango_leftarrow ? TEXTWM(leftarrow) : TEXTW(leftarrow); + if (!hiderarrow) rarrowWidth = pango_rightarrow ? TEXTWM(rightarrow) : TEXTW(rightarrow); n = mw - (promptw + inputw + larrowWidth + rarrowWidth + modeWidth + numberWidth); }