Apply case insensitive patch
This commit is contained in:
23
config.h
Normal file
23
config.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
/* Default settings; can be overriden by command line. */
|
||||||
|
|
||||||
|
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
|
||||||
|
/* -fn option overrides fonts[0]; default X11 font or font set */
|
||||||
|
static const char *fonts[] = {
|
||||||
|
"monospace:size=10"
|
||||||
|
};
|
||||||
|
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
|
||||||
|
static const char *colors[SchemeLast][2] = {
|
||||||
|
/* fg bg */
|
||||||
|
[SchemeNorm] = { "#bbbbbb", "#222222" },
|
||||||
|
[SchemeSel] = { "#eeeeee", "#005577" },
|
||||||
|
[SchemeOut] = { "#000000", "#00ffff" },
|
||||||
|
};
|
||||||
|
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
|
||||||
|
static unsigned int lines = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Characters not considered part of a word while deleting words
|
||||||
|
* for example: " /?\"&[]"
|
||||||
|
*/
|
||||||
|
static const char worddelimiters[] = " ";
|
11
dmenu.c
11
dmenu.c
@@ -55,8 +55,9 @@ static Clr *scheme[SchemeLast];
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
|
static char * cistrstr(const char *s, const char *sub);
|
||||||
static char *(*fstrstr)(const char *, const char *) = strstr;
|
static int (*fstrncmp)(const char *, const char *, size_t) = strncasecmp;
|
||||||
|
static char *(*fstrstr)(const char *, const char *) = cistrstr;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
appenditem(struct item *item, struct item **list, struct item **last)
|
appenditem(struct item *item, struct item **list, struct item **last)
|
||||||
@@ -709,9 +710,9 @@ main(int argc, char *argv[])
|
|||||||
topbar = 0;
|
topbar = 0;
|
||||||
else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
|
else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
|
||||||
fast = 1;
|
fast = 1;
|
||||||
else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
|
else if (!strcmp(argv[i], "-s")) { /* case-sensitive item matching */
|
||||||
fstrncmp = strncasecmp;
|
fstrncmp = strncmp;
|
||||||
fstrstr = cistrstr;
|
fstrstr = strstr;
|
||||||
} else if (i + 1 == argc)
|
} else if (i + 1 == argc)
|
||||||
usage();
|
usage();
|
||||||
/* these options take one argument */
|
/* these options take one argument */
|
||||||
|
42
patches/dmenu-caseinsensitive-20200523-db6093f.diff
Normal file
42
patches/dmenu-caseinsensitive-20200523-db6093f.diff
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
From 54acbdf72083a5eae5783eed42e162424ab2cec2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kim Torgersen <kim@torgersen.se>
|
||||||
|
Date: Sat, 23 May 2020 14:48:28 +0200
|
||||||
|
Subject: [PATCH] case-insensitive item matching default, case-sensitive option
|
||||||
|
(-s)
|
||||||
|
|
||||||
|
---
|
||||||
|
dmenu.c | 11 ++++++-----
|
||||||
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dmenu.c b/dmenu.c
|
||||||
|
index 65f25ce..855df59 100644
|
||||||
|
--- a/dmenu.c
|
||||||
|
+++ b/dmenu.c
|
||||||
|
@@ -55,8 +55,9 @@ static Clr *scheme[SchemeLast];
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
-static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
|
||||||
|
-static char *(*fstrstr)(const char *, const char *) = strstr;
|
||||||
|
+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;
|
||||||
|
|
||||||
|
static void
|
||||||
|
appenditem(struct item *item, struct item **list, struct item **last)
|
||||||
|
@@ -709,9 +710,9 @@ main(int argc, char *argv[])
|
||||||
|
topbar = 0;
|
||||||
|
else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
|
||||||
|
fast = 1;
|
||||||
|
- else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
|
||||||
|
- fstrncmp = strncasecmp;
|
||||||
|
- fstrstr = cistrstr;
|
||||||
|
+ else if (!strcmp(argv[i], "-s")) { /* case-sensitive item matching */
|
||||||
|
+ fstrncmp = strncmp;
|
||||||
|
+ fstrstr = strstr;
|
||||||
|
} else if (i + 1 == argc)
|
||||||
|
usage();
|
||||||
|
/* these options take one argument */
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
Reference in New Issue
Block a user