aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-01-25 21:59:58 +0100
committerbptato <nincsnevem662@gmail.com>2022-01-25 21:59:58 +0100
commitaaf1ff614298a64cf0be1adf1a3d5d28882318e7 (patch)
tree973e5b61867a4b03b74810dbcc65ae7c31767042 /src/utils
parent51d09498f2377804b65c167b49a5efb2703abe89 (diff)
downloadchawan-aaf1ff614298a64cf0be1adf1a3d5d28882318e7.tar.gz
Zero-width characters don't break words
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/twtstr.nim6
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()