diff options
author | zachir <zachir@librem.one> | 2023-02-21 14:30:34 -0600 |
---|---|---|
committer | zachir <zachir@librem.one> | 2023-02-21 14:30:34 -0600 |
commit | ee4eee0e05b567fe72f94eabcec9656a096625bc (patch) | |
tree | af857dbbee2fae2f7ff2674750c0871b24c753b5 /patches/dmenu-fuzzyhighlight-4.9.diff | |
parent | 0e8723fdc24c099954f6356f22d1a1df47eddb20 (diff) | |
parent | 96e4a549ce8b3da7d5d339a94487bb2849520ae7 (diff) |
merge master to version 5.25.2
Diffstat (limited to 'patches/dmenu-fuzzyhighlight-4.9.diff')
-rw-r--r-- | patches/dmenu-fuzzyhighlight-4.9.diff | 152 |
1 files changed, 0 insertions, 152 deletions
diff --git a/patches/dmenu-fuzzyhighlight-4.9.diff b/patches/dmenu-fuzzyhighlight-4.9.diff deleted file mode 100644 index 58d5c6f..0000000 --- a/patches/dmenu-fuzzyhighlight-4.9.diff +++ /dev/null @@ -1,152 +0,0 @@ -Author: Chris Noxz <chris@noxz.tech> -note: This patch is meant to be used together with fuzzymatch - -diff -upN dmenu-4.9/config.def.h dmenu-4.9-fuzzyhighlight/config.def.h ---- dmenu-4.9/config.def.h 2019-02-02 13:55:02.000000000 +0100 -+++ dmenu-4.9-fuzzyhighlight/config.def.h 2020-04-04 10:26:36.990890854 +0200 -@@ -11,6 +11,8 @@ static const char *colors[SchemeLast][2] - /* fg bg */ - [SchemeNorm] = { "#bbbbbb", "#222222" }, - [SchemeSel] = { "#eeeeee", "#005577" }, -+ [SchemeSelHighlight] = { "#ffc978", "#005577" }, -+ [SchemeNormHighlight] = { "#ffc978", "#222222" }, - [SchemeOut] = { "#000000", "#00ffff" }, - }; - /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ -diff -upN dmenu-4.9/dmenu.1 dmenu-4.9-fuzzyhighlight/dmenu.1 ---- dmenu-4.9/dmenu.1 2019-02-02 13:55:02.000000000 +0100 -+++ dmenu-4.9-fuzzyhighlight/dmenu.1 2020-04-04 10:30:16.430054933 +0200 -@@ -20,6 +20,14 @@ dmenu \- dynamic menu - .IR color ] - .RB [ \-sf - .IR color ] -+.RB [ \-nhb -+.IR color ] -+.RB [ \-nhf -+.IR color ] -+.RB [ \-shb -+.IR color ] -+.RB [ \-shf -+.IR color ] - .RB [ \-w - .IR windowid ] - .P -@@ -75,6 +83,18 @@ defines the selected background color. - .BI \-sf " color" - defines the selected foreground color. - .TP -+.BI \-nhb " color" -+defines the normal highlight background color. -+.TP -+.BI \-nhf " color" -+defines the normal highlight foreground color. -+.TP -+.BI \-shb " color" -+defines the selected highlight background color. -+.TP -+.BI \-shf " color" -+defines the selected highlight foreground color. -+.TP - .B \-v - prints version information to stdout, then exits. - .TP -diff -upN dmenu-4.9/dmenu.c dmenu-4.9-fuzzyhighlight/dmenu.c ---- dmenu-4.9/dmenu.c 2019-02-02 13:55:02.000000000 +0100 -+++ dmenu-4.9-fuzzyhighlight/dmenu.c 2020-04-04 10:27:43.888026309 +0200 -@@ -26,7 +26,9 @@ - #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) - - /* enums */ --enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ -+enum { SchemeNorm, SchemeSel, SchemeNormHighlight, SchemeSelHighlight, -+ SchemeOut, SchemeLast }; /* color schemes */ -+ - - struct item { - char *text; -@@ -113,9 +115,49 @@ cistrstr(const char *s, const char *sub) - return NULL; - } - -+static void -+drawhighlights(struct item *item, int x, int y, int maxw) -+{ -+ int i, indent; -+ char *highlight; -+ char c; -+ -+ if (!(strlen(item->text) && strlen(text))) -+ return; -+ -+ drw_setscheme(drw, scheme[item == sel -+ ? SchemeSelHighlight -+ : SchemeNormHighlight]); -+ for (i = 0, highlight = item->text; *highlight && text[i];) { -+ if (*highlight == text[i]) { -+ /* get indentation */ -+ c = *highlight; -+ *highlight = '\0'; -+ indent = TEXTW(item->text); -+ *highlight = c; -+ -+ /* highlight character */ -+ c = highlight[1]; -+ highlight[1] = '\0'; -+ drw_text( -+ drw, -+ x + indent - (lrpad / 2), -+ y, -+ MIN(maxw - indent, TEXTW(highlight) - lrpad), -+ bh, 0, highlight, 0 -+ ); -+ highlight[1] = c; -+ i++; -+ } -+ highlight++; -+ } -+} -+ -+ - static int - drawitem(struct item *item, int x, int y, int w) - { -+ int r; - if (item == sel) - drw_setscheme(drw, scheme[SchemeSel]); - else if (item->out) -@@ -123,7 +165,9 @@ drawitem(struct item *item, int x, int y - else - drw_setscheme(drw, scheme[SchemeNorm]); - -- return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); -+ r = drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); -+ drawhighlights(item, x, y, w); -+ return r; - } - - static void -@@ -683,7 +727,8 @@ static void - usage(void) - { - fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" -- " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr); -+ " [-nb color] [-nf color] [-sb color] [-sf color]\n" -+ " [-nhb color] [-nhf color] [-shb color] [-shf color] [-w windowid]\n", stderr); - exit(1); - } - -@@ -724,6 +769,14 @@ main(int argc, char *argv[]) - colors[SchemeSel][ColBg] = argv[++i]; - else if (!strcmp(argv[i], "-sf")) /* selected foreground color */ - colors[SchemeSel][ColFg] = argv[++i]; -+ else if (!strcmp(argv[i], "-nhb")) /* normal hi background color */ -+ colors[SchemeNormHighlight][ColBg] = argv[++i]; -+ else if (!strcmp(argv[i], "-nhf")) /* normal hi foreground color */ -+ colors[SchemeNormHighlight][ColFg] = argv[++i]; -+ else if (!strcmp(argv[i], "-shb")) /* selected hi background color */ -+ colors[SchemeSelHighlight][ColBg] = argv[++i]; -+ else if (!strcmp(argv[i], "-shf")) /* selected hi foreground color */ -+ colors[SchemeSelHighlight][ColFg] = argv[++i]; - else if (!strcmp(argv[i], "-w")) /* embedding window id */ - embed = argv[++i]; - else |