mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
Addiing the case-insensitive patch
This commit is contained in:
parent
69baafdebf
commit
9248bbb392
@ -15,6 +15,8 @@ Refer to [https://tools.suckless.org/dmenu/](https://tools.suckless.org/dmenu/)
|
||||
|
||||
### Changelog:
|
||||
|
||||
2020-06-10 - Added the case-insensitive patch
|
||||
|
||||
2020-05-29 - Added the alpha patch (derived from Baitinq's [build](https://github.com/Baitinq/dmenu)) and the color emoji patch
|
||||
|
||||
2020-04-05 - Added fuzzyhighlight patch
|
||||
@ -35,6 +37,9 @@ Refer to [https://tools.suckless.org/dmenu/](https://tools.suckless.org/dmenu/)
|
||||
- [border](http://tools.suckless.org/dmenu/patches/border/)
|
||||
- adds a border around the dmenu window
|
||||
|
||||
- [case-insensitive](http://tools.suckless.org/dmenu/patches/case-insensitive/)
|
||||
- makes dmenu case-insensitive by default, replacing the case-insensitive \-i option with a case sensitive \-s option
|
||||
|
||||
- [center](https://tools.suckless.org/dmenu/patches/center/)
|
||||
- this patch centers dmenu in the middle of the screen
|
||||
|
||||
|
21
dmenu.c
21
dmenu.c
@ -103,8 +103,14 @@ static Clr *scheme[SchemeLast];
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if CASEINSENSITIVE_PATCH
|
||||
static char * cistrstr(const char *s, const char *sub);
|
||||
static int (*fstrncmp)(const char *, const char *, size_t) = strncasecmp;
|
||||
static char *(*fstrstr)(const char *, const char *) = cistrstr;
|
||||
#else
|
||||
static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
|
||||
static char *(*fstrstr)(const char *, const char *) = strstr;
|
||||
#endif // CASEINSENSITIVE_PATCH
|
||||
|
||||
static void appenditem(struct item *item, struct item **list, struct item **last);
|
||||
static void calcoffsets(void);
|
||||
@ -1120,16 +1126,21 @@ setup(void)
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fputs("usage: dmenu [-bfv"
|
||||
fputs("usage: dmenu [-bv"
|
||||
#if CENTER_PATCH
|
||||
"c"
|
||||
#endif
|
||||
#if !NON_BLOCKING_STDIN_PATCH
|
||||
"i"
|
||||
"f"
|
||||
#endif // NON_BLOCKING_STDIN_PATCH
|
||||
#if INCREMENTAL_PATCH
|
||||
"r"
|
||||
#endif // INCREMENTAL_PATCH
|
||||
#if CASEINSENSITIVE_PATCH
|
||||
"s"
|
||||
#else
|
||||
"i"
|
||||
#endif // CASEINSENSITIVE_PATCH
|
||||
#if INSTANT_PATCH
|
||||
"n"
|
||||
#endif // INSTANT_PATCH
|
||||
@ -1206,9 +1217,15 @@ main(int argc, char *argv[])
|
||||
} else if (!strcmp(argv[i], "-r")) { /* incremental */
|
||||
incremental = !incremental;
|
||||
#endif // INCREMENTAL_PATCH
|
||||
#if CASEINSENSITIVE_PATCH
|
||||
} else if (!strcmp(argv[i], "-s")) { /* case-sensitive item matching */
|
||||
fstrncmp = strncmp;
|
||||
fstrstr = strstr;
|
||||
#else
|
||||
} else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
|
||||
fstrncmp = strncasecmp;
|
||||
fstrstr = cistrstr;
|
||||
#endif // CASEINSENSITIVE_PATCH
|
||||
#if INSTANT_PATCH
|
||||
} else if (!strcmp(argv[i], "-n")) { /* instant select only match */
|
||||
instant = !instant;
|
||||
|
@ -12,6 +12,12 @@
|
||||
*/
|
||||
#define BORDER_PATCH 0
|
||||
|
||||
/* This patch makes dmenu case-insensitive by default, replacing the
|
||||
* case-insensitive -i option with a case sensitive -s option.
|
||||
* http://tools.suckless.org/dmenu/patches/case-insensitive/
|
||||
*/
|
||||
#define CASEINSENSITIVE_PATCH 0
|
||||
|
||||
/* This patch centers dmenu in the middle of the screen.
|
||||
* https://tools.suckless.org/dmenu/patches/center/
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user