password argument fix

This commit is contained in:
speedie 2023-03-28 23:35:46 +02:00
parent f773ca8a38
commit d91dec4010
6 changed files with 3 additions and 13 deletions

1
TODO
View file

@ -4,4 +4,3 @@
- Add configuration file using (probably) libconfig - Add configuration file using (probably) libconfig
- Use higher level libraries, MD5() is deprecated as of OpenSSL 3 but it has been temporarily silenced. This might also improve compatibility for people who don't use OpenSSL. - Use higher level libraries, MD5() is deprecated as of OpenSSL 3 but it has been temporarily silenced. This might also improve compatibility for people who don't use OpenSSL.
- Contextual completions - Contextual completions
- Fix segmentation fault when using -P option (i don't have time to fix it just yet)

View file

@ -70,9 +70,6 @@ You may use long, descriptive arguments or the shorter arguments.
`-P, --password ` `-P, --password `
: Hide characters : Hide characters
`-Ps, --password-symbol symbol `
: Set the password symbol to symbol
`-p, --prompt text ` `-p, --prompt text `
: Set spmenu prompt text to text : Set spmenu prompt text to text

View file

@ -169,8 +169,6 @@ readargs(int argc, char *argv[])
if (lines == 0) lines = 1; if (lines == 0) lines = 1;
} else if (!strcmp(argv[i], "-mc") || (!strcmp(argv[i], "--max-cache"))) { // max cache } else if (!strcmp(argv[i], "-mc") || (!strcmp(argv[i], "--max-cache"))) { // max cache
maxcache = atoi(argv[++i]); maxcache = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-") || (!strcmp(argv[i], "--password-symbol"))) { // password symbol
password = argv[++i];
} else if (!strcmp(argv[i], "-l") || (!strcmp(argv[i], "--lines"))) { // number of lines in grid } else if (!strcmp(argv[i], "-l") || (!strcmp(argv[i], "--lines"))) { // number of lines in grid
lines = atoi(argv[++i]); lines = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-mh") || (!strcmp(argv[i], "--lineheight"))) { // line height } else if (!strcmp(argv[i], "-mh") || (!strcmp(argv[i], "--lineheight"))) { // line height
@ -363,7 +361,6 @@ usage(void)
"spmenu -F, --fuzzy Enable fuzzy matching\n" "spmenu -F, --fuzzy Enable fuzzy matching\n"
"spmenu -NF, --no-fuzzy Disable fuzzy matching\n" "spmenu -NF, --no-fuzzy Disable fuzzy matching\n"
"spmenu -P, --password Hide characters\n" "spmenu -P, --password Hide characters\n"
"spmenu -Ps, --password-symbol <symbol> Set the password symbol to <symbol>\n"
"spmenu -p, --prompt <text> Set spmenu prompt text to <text>\n" "spmenu -p, --prompt <text> Set spmenu prompt text to <text>\n"
"spmenu -ip, --indent Indent items to prompt width\n" "spmenu -ip, --indent Indent items to prompt width\n"
"spmenu -nip, --no-indent Don't indent items to prompt width\n" "spmenu -nip, --no-indent Don't indent items to prompt width\n"

View file

@ -250,8 +250,8 @@ drawinput(int x, int y, int w)
w = (lines > 0 || !matches) ? mw - x : inputw; w = (lines > 0 || !matches) ? mw - x : inputw;
drw_setscheme(drw, scheme[SchemeInput]); drw_setscheme(drw, scheme[SchemeInput]);
if (passwd && !hideprompt) { if (passwd && !hideprompt) {
censort = ecalloc(pango_input ? TEXTWM(password) : TEXTW(password), sizeof(text)); censort = ecalloc(1, sizeof(text));
memset(censort, *password, strlen(text)); memset(censort, (int)password, strlen(text));
apply_fribidi(censort); apply_fribidi(censort);
drw_text(drw, x, 0, w, bh, lrpad / 2, isrtl ? fribidi_text : censort, 0, pango_password ? True : False); drw_text(drw, x, 0, w, bh, lrpad / 2, isrtl ? fribidi_text : censort, 0, pango_password ? True : False);

View file

@ -40,7 +40,7 @@ static char font[] = "Noto Sans Mono 8"; /* Font to draw tex
/* Symbol options */ /* Symbol options */
static char *leftarrow = "<"; /* Left arrow, used to indicate you can move to the left */ static char *leftarrow = "<"; /* Left arrow, used to indicate you can move to the left */
static char *rightarrow = ">"; /* Right arrow, used to indicate you can move to the right */ static char *rightarrow = ">"; /* Right arrow, used to indicate you can move to the right */
static char *password = "."; /* Password character, when the -P argument is active this will replace all characters typed */ static char password = '*'; /* Password character, when the -P argument is active this will replace all characters typed */
/* Match options */ /* Match options */
static int type = 1; /* Allow typing into spmenu or only allow keybinds. */ static int type = 1; /* Allow typing into spmenu or only allow keybinds. */

View file

@ -86,9 +86,6 @@ Disable fuzzy matching
\f[V]-P, --password\f[R] \f[V]-P, --password\f[R]
Hide characters Hide characters
.TP .TP
\f[V]-Ps, --password-symbol symbol\f[R]
Set the password symbol to symbol
.TP
\f[V]-p, --prompt text\f[R] \f[V]-p, --prompt text\f[R]
Set spmenu prompt text to text Set spmenu prompt text to text
.TP .TP