commit - 7ca8829beeb2ec15877e2be545af7a3d91dec62a
commit + 9e94fcbe75c5556f90ecc7416376458fdc0845d0
blob - 78f938aad87ffec4fe5222987fc9f1161cb6dca3
blob + 075e0cb33fa7a8bb82a397eb30f157422802bdd2
--- mymenu.1
+++ mymenu.1
Application specific resources:
.Bl -tag -width Ds
.It MyMenu.font
-The font name, only bitmap font are supported. By default is set to
-"fixed". If compiled with Xft(3) support this will be passed to xft.
+The font name to use. By default is set to "fixed" if compiled without
+Xft(3) support, "monospace" otherwise. Without Xft(3) only bitmap font
+are supported.
.It MyMenu.layout
The layout of the menu. The possible values are "horizontal" and
"vertical", with the default being "horizontal". Every other value
with the % sign is supplied, then the default value for that field
will be treated as a percentage. Since this is a misuse of the
resources this behavior isn't strictly considered a bug.
+.It
+C-w (delete last word) does not work well with multi-byte string. The
+whole UTF-8 support is still kinda naïve and should be improved.
.El
.Sh EXIT STATUS
blob - da930cad496fdd9648f6d447475d981e62bbf6c7
blob + bfc01c780f3550af15b3e263f95e89ffb968b76f
--- mymenu.c
+++ mymenu.c
#define resname "MyMenu"
#define resclass "mymenu"
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#ifdef USE_XFT
+# define default_fontname "monospace"
+#else
+# define default_fontname "fixed"
+#endif
+
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
+// If we don't have it or we don't want an "ignore case" completion
+// style, fall back to `strstr(3)`
+#ifndef USE_STRCASESTR
+#define strcasestr strstr
+#endif
#define update_completions(cs, text, lines) { \
compl_delete(cs); \
#define INITIAL_ITEMS 64
-#define TODO(s) { \
- fprintf(stderr, "TODO! " s "\n"); \
- }
-
#define cannot_allocate_memory { \
fprintf(stderr, "Could not allocate memory\n"); \
- exit(EX_UNAVAILABLE); \
+ abort(); \
}
#define check_allocation(a) { \
if (l == nil)
break;
- if (strstr(l, text) != nil) {
+ if (strcasestr(l, text) != nil) {
c->next = compl_new();
c = c->next;
c->completion = l;
char *ps1 = strdup("$ ");
check_allocation(ps1);
- char *fontname = strdup("fixed");
+ char *fontname = strdup(default_fontname);
check_allocation(fontname);
int textlen = 10;