selection: break out isword() to a new file

This commit is contained in:
Daniel Eklöf 2019-12-03 19:16:05 +01:00
parent f1c876884a
commit 198529525c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 32 additions and 21 deletions

24
misc.c Normal file
View file

@ -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;
}
}