diff options
author | bptato <nincsnevem662@gmail.com> | 2022-01-25 21:59:58 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-01-25 21:59:58 +0100 |
commit | aaf1ff614298a64cf0be1adf1a3d5d28882318e7 (patch) | |
tree | 973e5b61867a4b03b74810dbcc65ae7c31767042 /src/utils/twtstr.nim | |
parent | 51d09498f2377804b65c167b49a5efb2703abe89 (diff) | |
download | chawan-aaf1ff614298a64cf0be1adf1a3d5d28882318e7.tar.gz |
Zero-width characters don't break words
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r-- | src/utils/twtstr.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim index a0dd1b3f..6db61fc2 100644 --- a/src/utils/twtstr.nim +++ b/src/utils/twtstr.nim @@ -190,9 +190,6 @@ func isAlphaAscii*(r: Rune): bool = func isDigitAscii*(r: Rune): bool = return int(r) < 256 and isDigit(char(r)) -func breaksWord*(r: Rune): bool = - return not (r.isDigitAscii() or r.isAlpha()) - func substr*(s: seq[Rune], i, j: int): seq[Rune] = if s.len == 0: return @[] @@ -853,6 +850,9 @@ func width*(s: seq[Rune], min: int): int = result += width(s[i]) inc i +func breaksWord*(r: Rune): bool = + return not (r.isDigitAscii() or r.isAlpha() or r.width() == 0) + const CanHaveDakuten = "かきくけこさしすせそたちつてとはひふへほカキクケコサシスセソタチツテトハヒフヘホ".toRunes() const CanHaveHandakuten = "はひふへほハヒフヘホ".toRunes() |