aboutsummaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-12-03 18:16:05 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-12-03 18:16:58 +0000
commit198529525c788f51babcd425ea7dcdb4d8125c04 (patch)
tree11297bc7c465b3d11ccecf40af6a3d581deaa8bd /misc.c
parentinput: discard canceled compose sequences (diff)
selection: break out isword() to a new file
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/misc.c b/misc.c
new file mode 100644
index 00000000..b8eb3296
--- /dev/null
+++ b/misc.c
@@ -0,0 +1,24 @@
+#include "misc.h"
+
+#include <wctype.h>
+
+bool
+isword(wchar_t wc, bool spaces_only)
+{
+ if (spaces_only)
+ return iswgraph(wc);
+
+ switch (wc) {
+ default: return iswgraph(wc);
+
+ case L'(': case L')':
+ case L'[': case L']':
+ case L'{': case L'}':
+ case L'<': case L'>':
+ case L'│': case L'|':
+ case L',':
+ case L'`': case L'"': case L'\'':
+ case L':':
+ return false;
+ }
+}