Diff

util/human/io.lua @ 11897:e84ea5b58b29

util.human.io: Use UTF-8-aware length check in padding functions
author Kim Alvefur <zash@zash.se>
date Fri, 12 Nov 2021 14:22:21 +0100
parent 11896:93e9f7ae2f9b
child 12573:0f4feaf9ca64
line wrap: on
line diff
--- a/util/human/io.lua	Fri Nov 12 14:21:15 2021 +0100
+++ b/util/human/io.lua	Fri Nov 12 14:22:21 2021 +0100
@@ -93,11 +93,11 @@
 end
 
 local function padright(s, width)
-	return s..string.rep(" ", width-#s);
+	return s..string.rep(" ", width-len(s));
 end
 
 local function padleft(s, width)
-	return string.rep(" ", width-#s)..s;
+	return string.rep(" ", width-len(s))..s;
 end
 
 local pat = "[%z\001-\127\194-\253][\128-\191]*";