about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-05-04 17:21:59 +0200
committerbptato <nincsnevem662@gmail.com>2025-05-04 17:26:10 +0200
commit2108dcdab067a1ca43631b5ae2afd0ef75d310bd (patch)
tree2f103f02058d0f7e08d122fada6adf49dec14eba
parentbee4f12b0348e8893d62a01ce027b1550bb6ef09 (diff)
downloadchawan-2108dcdab067a1ca43631b5ae2afd0ef75d310bd.tar.gz
man, genidna: do not use std/unicode
-rw-r--r--Makefile2
-rw-r--r--adapter/protocol/man.nim3
-rw-r--r--res/genidna.nim5
3 files changed, 5 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 0492253d..7a129061 100644
--- a/Makefile
+++ b/Makefile
@@ -110,7 +110,7 @@ $(OUTDIR_BIN)/mancha: adapter/tools/mancha.nim
 unicode_version = 16.0.0
 
 .PHONY: unicode_gen
-unicode_gen: $(OBJDIR)/genidna $(OBJDIR)/gencharwidth
+unicode_gen:
 	@printf 'Download EastAsianWidth.txt and IdnaMappingTable.txt from www.unicode.org? (y/n) '
 	@read res; if test "$$res" = "y"; then \
 	cha -d 'https://www.unicode.org/Public/idna/$(unicode_version)/IdnaMappingTable.txt' >res/map/IdnaMappingTable.txt; \
diff --git a/adapter/protocol/man.nim b/adapter/protocol/man.nim
index a8c4ae34..d1566b87 100644
--- a/adapter/protocol/man.nim
+++ b/adapter/protocol/man.nim
@@ -1,7 +1,6 @@
 import std/os
 import std/posix
 import std/strutils
-from std/unicode import runeLenAt
 
 import monoucha/jsregex
 import monoucha/libregexp
@@ -51,7 +50,7 @@ func processBackspace(line: string): string =
       bspace = true
       inc i
       continue
-    let n = line.runeLenAt(i)
+    let n = line.pointLenAt(i)
     if thiscs.len == 0:
       thiscs = i ..< i + n
       i += n
diff --git a/res/genidna.nim b/res/genidna.nim
index 4ae9d34c..911c67ad 100644
--- a/res/genidna.nim
+++ b/res/genidna.nim
@@ -3,7 +3,8 @@ import std/sets
 import std/streams
 import std/strutils
 import std/tables
-import std/unicode
+
+import utils/twtstr
 
 type
   LowMap = seq[tuple[ucs: uint16, s: string]]
@@ -116,7 +117,7 @@ proc loadIdnaData() =
       let codepoints = thirdcol
       var str = ""
       for code in codepoints:
-        str &= Rune(parseHexInt(code))
+        str &= uint32(parseHexInt(code)).toUTF8()
 
       add(firstcol, str, add_map)
     of "valid":