fix: easySyntax not working for ""

This commit is contained in:
tour 2024-02-16 10:54:16 +01:00
parent 9dff1acb83
commit e7b45e1e97
3 changed files with 5 additions and 3 deletions

View File

@ -18,7 +18,7 @@ predefined (optional): if valid, it will skip the selection formspec and direct
context.easy_syntax = minetest.formspec_escape(params[2])
end
else
context.easy_syntax = " "
context.easy_syntax = ""
end
chat_formspec.show_sender_fs(name)
return true

View File

@ -65,7 +65,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local target_fs = chat_formspec.create_target_fs(context)
chat_formspec.show_to_target(name, target_fs)
elseif fields.update then
context.easy_syntax = minetest.formspec_escape(fields.easy_syntax) or " "
context.easy_syntax = minetest.formspec_escape(fields.easy_syntax) or ""
chat_formspec.show_sender_fs(name)
elseif fields.select and not(fields.key_enter and fields.key_enter_field) then
context.easy_syntax = chat_formspec.preset[fields.select] or ""

View File

@ -2,7 +2,9 @@ local S = minetest.get_translator("chat_formspec")
function chat_formspec.easy_syntax_to_formspec(context)
local fs_def = string.split(context.easy_syntax, "#", false, -1, false)
if #fs_def == 0 then -- easy_syntax being "" or "#"
fs_def = {""}
end
local target_template = "button[11.3,0.3;3,0.8;chat_help;" .. S("How to chat?") .. "]" ..
"textarea[0.4,0.3;10.5,1;;;" .. S("I (@1) tried to contact you via chat already, but you did not respond", "%s") .. "]" ..
"textarea[0.4,1.5;13.8,4.2;;;%s]"