mirror of
https://github.com/eRgo35/dots.git
synced 2025-12-16 23:46:13 +01:00
moving software to separate submodules part 1
This commit is contained in:
57
desktop/.dmenu/patch/fuzzyhighlight.c
Normal file
57
desktop/.dmenu/patch/fuzzyhighlight.c
Normal file
@@ -0,0 +1,57 @@
|
||||
static void
|
||||
#if EMOJI_HIGHLIGHT_PATCH
|
||||
drawhighlights(struct item *item, char *output, int x, int y, int maxw)
|
||||
#else
|
||||
drawhighlights(struct item *item, int x, int y, int maxw)
|
||||
#endif // EMOJI_HIGHLIGHT_PATCH
|
||||
{
|
||||
int i, indent;
|
||||
char *highlight;
|
||||
char c;
|
||||
|
||||
#if EMOJI_HIGHLIGHT_PATCH
|
||||
char *itemtext = output;
|
||||
#elif TSV_PATCH && !SEPARATOR_PATCH
|
||||
char *itemtext = item->stext;
|
||||
#else
|
||||
char *itemtext = item->text;
|
||||
#endif // TSV_PATCH
|
||||
|
||||
if (!(strlen(itemtext) && strlen(text)))
|
||||
return;
|
||||
|
||||
drw_setscheme(drw, scheme[item == sel
|
||||
? SchemeSelHighlight
|
||||
: SchemeNormHighlight]);
|
||||
for (i = 0, highlight = itemtext; *highlight && text[i];) {
|
||||
#if FUZZYMATCH_PATCH
|
||||
if (!fstrncmp(&(*highlight), &text[i], 1))
|
||||
#else
|
||||
if (*highlight == text[i])
|
||||
#endif // FUZZYMATCH_PATCH
|
||||
{
|
||||
/* get indentation */
|
||||
c = *highlight;
|
||||
*highlight = '\0';
|
||||
indent = TEXTW(itemtext) - lrpad;
|
||||
*highlight = c;
|
||||
|
||||
/* highlight character */
|
||||
c = highlight[1];
|
||||
highlight[1] = '\0';
|
||||
drw_text(
|
||||
drw,
|
||||
x + indent + (lrpad / 2),
|
||||
y,
|
||||
MIN(maxw - indent - lrpad, TEXTW(highlight) - lrpad),
|
||||
bh, 0, highlight, 0
|
||||
#if PANGO_PATCH
|
||||
, True
|
||||
#endif // PANGO_PATCH
|
||||
);
|
||||
highlight[1] = c;
|
||||
i++;
|
||||
}
|
||||
highlight++;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user