about summary refs log tree commit diff stats
path: root/src/utils/twtstr.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-08-05 22:57:38 +0200
committerbptato <nincsnevem662@gmail.com>2021-08-05 23:13:55 +0200
commitb94597a68eb8572cf8f521ee9c39cc7d9d310827 (patch)
treea487471466f80a4e95cfefb4d7084f29a840eacc /src/utils/twtstr.nim
parent087f830528b41b00d0bf7a501f7b0472f75ffb18 (diff)
downloadchawan-b94597a68eb8572cf8f521ee9c39cc7d9d310827.tar.gz
Implement new buffer model which supports X coords
...also, one can kinda use this as a file viewer now I guess
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r--src/utils/twtstr.nim8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 730f8b32..22207e2c 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -211,8 +211,7 @@ iterator split*(s: seq[Rune], sep: Rune): seq[Rune] =
 #
 #   - The null character (U+0000) has a column width of 0.
 #
-#   - Other C0/C1 control characters and DEL will lead to a return value of 2
-#     (changed from 0 b/c we normally display control chars like ^H - TODO?).
+#   - Other C0/C1 control characters and DEL will lead to a return value of 0
 #
 #   - Non-spacing and enclosing combining characters (general category code Mn
 #     or Me in the Unicode database) have a column width of 0.
@@ -305,7 +304,7 @@ func is_dwidth(r: Rune): bool =
 func makewidthtable(): array[0..0x10FFFF, byte] =
   for r in low(char)..high(char):
     if r.isControlChar():
-      result[int(r)] = 2
+      result[int(r)] = 2 #TODO this should be 0
     else:
       result[int(r)] = 1
 
@@ -545,6 +544,3 @@ proc fullwidth*(s: seq[Rune]): seq[Rune] =
 
 proc fullwidth*(s: string): string =
   return $fullwidth(s.toRunes())
-
-echo (halfwidth("とうギょう"))
-echo "東京"