mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
Adding restrict return patch
This commit is contained in:
parent
976d6bc04c
commit
d6894046f1
@ -26,6 +26,8 @@ dmenu, how to install it and how it works.
|
||||
|
||||
### Changelog:
|
||||
|
||||
2021-05-17 - Added the restrict return patch
|
||||
|
||||
2021-05-15 - Added the tsv and printindex patches
|
||||
|
||||
2020-08-08 - Added the json, symbols, managed, morecolor, multi-selection and preselect patches
|
||||
@ -179,6 +181,10 @@ dmenu, how to install it and how it works.
|
||||
- adds a new flag to dmenu with which text input will be rejected if it would result in no
|
||||
matching item
|
||||
|
||||
- [restrict-return](https://tools.suckless.org/dmenu/patches/restrict-return/)
|
||||
- adds a '-1' option which disables Shift-Return and Ctrl-Return
|
||||
- this guarantees that dmenu will only output one item, and that item was read from stdin
|
||||
|
||||
- [scroll](https://tools.suckless.org/dmenu/patches/scroll/)
|
||||
- this patch adds support for text scrolling
|
||||
- it doesn't append '...' for long input anymore as it can handle long text
|
||||
|
@ -18,6 +18,9 @@ static int instant = 0; /* -n option; if 1, selects matchin
|
||||
static int center = 1; /* -c option; if 0, dmenu won't be centered on the screen */
|
||||
static int min_width = 500; /* minimum width when centered */
|
||||
#endif // CENTER_PATCH
|
||||
#if RESTRICT_RETURN_PATCH
|
||||
static int restrict_return = 0; /* -1 option; if 1, disables shift-return and ctrl-return */
|
||||
#endif // RESTRICT_RETURN_PATCH
|
||||
/* -fn option overrides fonts[0]; default X11 font or font set */
|
||||
#if PANGO_PATCH
|
||||
static char font[] = "monospace 10";
|
||||
|
11
dmenu.c
11
dmenu.c
@ -925,6 +925,10 @@ insert:
|
||||
break;
|
||||
case XK_Return:
|
||||
case XK_KP_Enter:
|
||||
#if RESTRICT_RETURN_PATCH
|
||||
if (restrict_return && (!sel || ev->state & (ShiftMask | ControlMask)))
|
||||
break;
|
||||
#endif // RESTRICT_RETURN_PATCH
|
||||
#if !MULTI_SELECTION_PATCH
|
||||
#if JSON_PATCH
|
||||
if (!printjsonssel(ev->state))
|
||||
@ -1512,6 +1516,9 @@ usage(void)
|
||||
#if REJECTNOMATCH_PATCH
|
||||
"R" // (changed from r to R due to conflict with INCREMENTAL_PATCH)
|
||||
#endif // REJECTNOMATCH_PATCH
|
||||
#if RESTRICT_RETURN_PATCH
|
||||
"1"
|
||||
#endif // RESTRICT_RETURN_PATCH
|
||||
"] "
|
||||
#if MANAGED_PATCH
|
||||
"[-wm] "
|
||||
@ -1630,6 +1637,10 @@ main(int argc, char *argv[])
|
||||
} else if (!strcmp(argv[i], "-ix")) { /* adds ability to return index in list */
|
||||
print_index = 1;
|
||||
#endif // PRINTINDEX_PATCH
|
||||
#if RESTRICT_RETURN_PATCH
|
||||
} else if (!strcmp(argv[i], "-1")) {
|
||||
restrict_return = 1;
|
||||
#endif // RESTRICT_RETURN_PATCH
|
||||
} else if (i + 1 == argc)
|
||||
usage();
|
||||
/* these options take one argument */
|
||||
|
@ -233,6 +233,12 @@
|
||||
*/
|
||||
#define REJECTNOMATCH_PATCH 0
|
||||
|
||||
/* This patch adds a '-r' option which disables Shift-Return and Ctrl-Return.
|
||||
* This guarantees that dmenu will only output one item, and that item was read from stdin.
|
||||
* https://tools.suckless.org/dmenu/patches/restrict-return/
|
||||
*/
|
||||
#define RESTRICT_RETURN_PATCH 0
|
||||
|
||||
/* This patch adds support for text scrolling and no longer appends '...' for long input as
|
||||
* it can handle long text.
|
||||
* https://tools.suckless.org/dmenu/patches/scroll/
|
||||
|
Loading…
Reference in New Issue
Block a user