diff --git a/docs/example.Xresources b/docs/example.Xresources index bc8698a..65ad9c9 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -56,3 +56,4 @@ spmenu.class: spmenu spmenu.leftarrow: < spmenu.rightarrow: > spmenu.hidematchcount: 0 +spmenu.hidehighlight: 0 diff --git a/options.h b/options.h index 22a7219..7330cf3 100644 --- a/options.h +++ b/options.h @@ -50,6 +50,7 @@ static char *prompt = NULL; /* Default prompt, set to NULL (n /* Hide options */ static int hidematchcount = 0; /* Hide match count (0/1) */ +static int hidehighlight = 0; /* Hide highlight (0/1) */ /* Color options * diff --git a/spmenu.c b/spmenu.c index 1d91238..eb1fe41 100644 --- a/spmenu.c +++ b/spmenu.c @@ -346,9 +346,9 @@ drawitem(struct item *item, int x, int y, int w) drw_text(drw, x, y, rw + lp, bh, lp, buffer, 0, True); #endif - drawhighlights(item, x, y, rw + lp); x += rw + lp; ib = 1; + lp = 0; /* no padding */ char *ep = item->text + rd + 1; @@ -388,19 +388,15 @@ drawitem(struct item *item, int x, int y, int w) buffer[wr] = '\0'; - /* width needs to be decreased now because we've already drawn some text - * if we haven't drawn text, this does nothing at all. */ - w -= rw; - /* draw any text that doesn't use sgr sequences */ #if USERTL apply_fribidi(buffer); - int r = drw_text(drw, x, y, w, bh, lp, fribidi_text, 0, True); + int r = drw_text(drw, x, y, w - rw, bh, lp, fribidi_text, 0, True); #else - int r = drw_text(drw, x, y, w, bh, lp, buffer, 0, True); + int r = drw_text(drw, x, y, w - rw, bh, lp, buffer, 0, True); #endif - if (!ib) drawhighlights(item, x, y, w); + if (!hidehighlight && !ib) drawhighlights(item, x, y, w - rw); return r; } diff --git a/xresources.h b/xresources.h index 2796b25..d506a35 100644 --- a/xresources.h +++ b/xresources.h @@ -105,6 +105,7 @@ ResourcePref resources[] = { { "columns", INTEGER, &columns }, { "maxhist", INTEGER, &maxhist }, { "hidematchcount", INTEGER, &hidematchcount }, + { "hidehighlight", INTEGER, &hidehighlight }, { "histnodup", INTEGER, &histnodup }, { "casesensitive", INTEGER, &casesensitive }, };