personal config

This commit is contained in:
λmolinae 2025-06-22 22:21:48 -06:00
parent af6440da8f
commit 5a68bfbec1
7 changed files with 68 additions and 6 deletions

20
mew.c
View file

@ -280,6 +280,7 @@ drawmenu(void)
unsigned int curpos;
struct item *item;
int x = 0, y = 0, w;
char *censort;
DrwBuf *buf;
errno = 0;
@ -297,7 +298,13 @@ drawmenu(void)
/* draw input field */
w = (lines > 0 || !matches) ? mw - x : inputw;
drwl_setscheme(drw, colors[SchemeNorm]);
drwl_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
if (passwd) {
censort = calloc(1, sizeof(text));
memset(censort, '*', strlen(text));
drwl_text(drw, x, 0, w, bh, lrpad / 2, censort, 0);
free(censort);
} else
drwl_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
curpos = TEXTW(text) - TEXTW(&text[cursor]);
if ((curpos += lrpad / 2 - 1) < w) {
@ -908,6 +915,11 @@ readstdin(void)
size_t i, itemsiz = 0, linesiz = 0;
ssize_t len;
if (passwd) {
inputw = lines = 0;
return;
}
/* read each line from stdin and add it to the item list */
for (i = 0; (len = getline(&line, &linesiz, stdin)) != -1; i++) {
if (i + 1 >= itemsiz) {
@ -1003,7 +1015,7 @@ setup(void)
static void
usage(void)
{
die("usage: mew [-beiv] [-l lines] [-p prompt] [-f font] [-o output]\n"
die("usage: mew [-beivP] [-l lines] [-p prompt] [-f font] [-o output]\n"
" [-nb color] [-nf color] [-sb color] [-sf color]");
}
@ -1024,7 +1036,9 @@ main(int argc, char *argv[])
else if (!strcmp(argv[i], "-i")) {
fstrncmp = strncasecmp;
fstrstr = cistrstr;
} else if (i + 1 == argc)
} else if (!strcmp(argv[i], "-P"))
passwd = 1;
else if (i + 1 == argc)
usage();
else if (!strcmp(argv[i], "-l"))
lines = atoi(argv[++i]);