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:
|
### 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-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
|
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/)
|
- [border](http://tools.suckless.org/dmenu/patches/border/)
|
||||||
- adds a border around the dmenu window
|
- 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/)
|
- [center](https://tools.suckless.org/dmenu/patches/center/)
|
||||||
- this patch centers dmenu in the middle of the screen
|
- 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"
|
#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 int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
|
||||||
static char *(*fstrstr)(const char *, const char *) = strstr;
|
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 appenditem(struct item *item, struct item **list, struct item **last);
|
||||||
static void calcoffsets(void);
|
static void calcoffsets(void);
|
||||||
@ -1120,16 +1126,21 @@ setup(void)
|
|||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fputs("usage: dmenu [-bfv"
|
fputs("usage: dmenu [-bv"
|
||||||
#if CENTER_PATCH
|
#if CENTER_PATCH
|
||||||
"c"
|
"c"
|
||||||
#endif
|
#endif
|
||||||
#if !NON_BLOCKING_STDIN_PATCH
|
#if !NON_BLOCKING_STDIN_PATCH
|
||||||
"i"
|
"f"
|
||||||
#endif // NON_BLOCKING_STDIN_PATCH
|
#endif // NON_BLOCKING_STDIN_PATCH
|
||||||
#if INCREMENTAL_PATCH
|
#if INCREMENTAL_PATCH
|
||||||
"r"
|
"r"
|
||||||
#endif // INCREMENTAL_PATCH
|
#endif // INCREMENTAL_PATCH
|
||||||
|
#if CASEINSENSITIVE_PATCH
|
||||||
|
"s"
|
||||||
|
#else
|
||||||
|
"i"
|
||||||
|
#endif // CASEINSENSITIVE_PATCH
|
||||||
#if INSTANT_PATCH
|
#if INSTANT_PATCH
|
||||||
"n"
|
"n"
|
||||||
#endif // INSTANT_PATCH
|
#endif // INSTANT_PATCH
|
||||||
@ -1206,9 +1217,15 @@ main(int argc, char *argv[])
|
|||||||
} else if (!strcmp(argv[i], "-r")) { /* incremental */
|
} else if (!strcmp(argv[i], "-r")) { /* incremental */
|
||||||
incremental = !incremental;
|
incremental = !incremental;
|
||||||
#endif // INCREMENTAL_PATCH
|
#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 */
|
} else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
|
||||||
fstrncmp = strncasecmp;
|
fstrncmp = strncasecmp;
|
||||||
fstrstr = cistrstr;
|
fstrstr = cistrstr;
|
||||||
|
#endif // CASEINSENSITIVE_PATCH
|
||||||
#if INSTANT_PATCH
|
#if INSTANT_PATCH
|
||||||
} else if (!strcmp(argv[i], "-n")) { /* instant select only match */
|
} else if (!strcmp(argv[i], "-n")) { /* instant select only match */
|
||||||
instant = !instant;
|
instant = !instant;
|
||||||
|
@ -12,6 +12,12 @@
|
|||||||
*/
|
*/
|
||||||
#define BORDER_PATCH 0
|
#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.
|
/* This patch centers dmenu in the middle of the screen.
|
||||||
* https://tools.suckless.org/dmenu/patches/center/
|
* https://tools.suckless.org/dmenu/patches/center/
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user