about summary refs log tree commit diff stats
path: root/src/utils
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-06 22:24:40 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-06 22:24:40 +0100
commit04bde8da293557c29ea24181708cecdce922e9bc (patch)
treea67e18a342684c23157d28430ed339d3480cdcac /src/utils
parent8323cf214819297cae0ce0908e339a78a289434a (diff)
downloadchawan-04bde8da293557c29ea24181708cecdce922e9bc.tar.gz
utils/twtstr: simplify mnormalize
Use the isAscii function for early return.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/twtstr.nim5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 5a5d5819..582d68d4 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -555,10 +555,7 @@ proc mnormalize*(rs: var seq[Rune], form = UNICODE_NFC) = {.cast(noSideEffect).}
 
 #TODO maybe a utf8 normalization procedure?
 proc mnormalize*(s: var string) =
-  block do_nothing:
-    for c in s:
-      if c notin Ascii:
-        break do_nothing
+  if s.isAscii():
     return # no need to normalize ascii
   var rs = s.toRunes()
   rs.mnormalize()