From 49f4b3da64d45cee04295ce005ff0399fcfeebe2 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 9 Oct 2020 19:44:23 +0200 Subject: config: add ‘[default].word-delimiters’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- misc.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index b8eb3296..feb5e73b 100644 --- a/misc.c +++ b/misc.c @@ -3,22 +3,13 @@ #include 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); } -- cgit v1.3