From 87d65439a1ec4de4ee26f45fce7f10a40bce28c6 Mon Sep 17 00:00:00 2001 From: 1F616EMO~nya Date: Sat, 7 Sep 2024 07:04:15 +0800 Subject: [PATCH] Convert CR(LF)s to LFs (#32) --- api.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api.lua b/api.lua index f07f0a3..edcb3ef 100644 --- a/api.lua +++ b/api.lua @@ -818,6 +818,9 @@ function signs_lib.update_sign(pos, fields) local ownstr = "" if owner ~= "" then ownstr = S("Locked sign, owned by @1\n", owner) end + -- Fix pasting from Windows: CR instead of LF + text = string.gsub(text, "\r\n?", "\n") + meta:set_string("text", text) meta:set_string("infotext", ownstr..make_infotext(text).." ")