Changeset

11648:96d3cbeb9275

util.format: Escape ASCII control characters also in extra arguments
author Kim Alvefur <zash@zash.se>
date Sat, 03 Jul 2021 04:35:29 +0200
parents 11647:0fe6a9a3676f
children 11650:a227bc35771e
files util/format.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/format.lua	Sat Jul 03 04:29:25 2021 +0200
+++ b/util/format.lua	Sat Jul 03 04:35:29 2021 +0200
@@ -79,7 +79,7 @@
 		if arg == nil then
 			args[i] = "(nil)";
 		else
-			args[i] = tostring(arg);
+			args[i] = tostring(arg):gsub("[%z\1-\8\11-\31\127]", control_symbols):gsub("\n\t?", "\n\t");
 		end
 		formatstring = formatstring .. " [%s]"
 	end