about summary refs log tree commit diff stats
path: root/src/utils/twtstr.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-01-22 15:25:52 +0100
committerbptato <nincsnevem662@gmail.com>2022-01-22 15:25:52 +0100
commit5148f88d52c4d8236eb9828921c6103056440102 (patch)
tree8fc717383b078aae5f2d3389c7f58155b8255244 /src/utils/twtstr.nim
parent352c2819ae7c8cd56d4f77954cfad9be45745f34 (diff)
downloadchawan-5148f88d52c4d8236eb9828921c6103056440102.tar.gz
Re-implement margins
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r--src/utils/twtstr.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 43e287fa..cb236b53 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -37,9 +37,15 @@ func fitValueToSize*(str: string, size: int): string =
     return str & ' '.repeat(size - str.runeLen)
   return str.maxString(size)
 
-func isWhitespace*(c: char): bool =
+func isWhitespace*(c: char): bool {.inline.} =
   return c in {' ', '\n', '\r', '\t', '\f'}
 
+func onlyWhitespace*(s: string): bool =
+  for c in s:
+    if not c.isWhitespace():
+      return false
+  return true
+
 const C0Controls = {chr(0x00)..chr(0x1F)}
 const Controls = (C0Controls + {chr(0x7F)})
 const Ascii* = {chr(0x00)..chr(0x7F)}