config: add ‘[default].word-delimiters’

This option lets the user configure which characters act as word
delimiters when selecting text.

This affects both “double clicking”, and ‘ctrl-w’ in scrollback search
mode.

Closes #156
This commit is contained in:
Daniel Eklöf 2020-10-09 19:44:23 +02:00
parent 8aba25a477
commit 49f4b3da64
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
8 changed files with 36 additions and 20 deletions

17
misc.c
View file

@ -3,22 +3,13 @@
#include <wctype.h>
bool
isword(wchar_t wc, bool spaces_only)
isword(wchar_t wc, bool spaces_only, const wchar_t *delimiters)
{
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':':
if (wcschr(delimiters, wc) != NULL)
return false;
}
return iswgraph(wc);
}