Changeset

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
parents 11896:93e9f7ae2f9b
children 11898:89aa591bb895
files util/human/io.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
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]*";