From e251c6463913bcd7c9c40b4dc168010f6de68b5a Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 5 Nov 2024 21:09:53 +0100 Subject: Check for whitespace after regex using islbrk() --- src/util.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index b5b1f8a..a946119 100644 --- a/src/util.c +++ b/src/util.c @@ -4,6 +4,8 @@ #include #include +#include +#include #include #include "exitcodes.h" @@ -47,4 +49,16 @@ getenv_posnum(const char *ev, int fallback) return (int)n; } return fallback; +} + +bool +islbrk(u8view_t g) +{ + return ucseq(g, U8("\n")) + || ucseq(g, U8("\v")) + || ucseq(g, U8("\f")) + || ucseq(g, U8("\r\n")) + || ucseq(g, U8("\x85")) + || ucseq(g, U8("\u2028")) + || ucseq(g, U8("\u2029")); } \ No newline at end of file -- cgit v1.2.3