diff --git a/fs_decorated.lua b/fs_decorated.lua index a77d21f..c7cd289 100644 --- a/fs_decorated.lua +++ b/fs_decorated.lua @@ -136,6 +136,14 @@ yl_speak_up.add_formspec_element_with_tooltip_if = function(formspec, element_ty return end table.insert(formspec, element_type.."["..position..";"..element_name..";"..element_text.."]") + + -- make sure the lines in the mouseover text don't get too long + -- each paragraph has to be split seperately so that the old newlines are kept + local paragraphs = string.split(tooltip, "\n", true, -1, false) + for i, p in ipairs(paragraphs) do + paragraphs[i] = minetest.wrap_text(paragraphs[i], 100, false) + end + tooltip = table.concat(paragraphs, "\n") table.insert(formspec, "tooltip["..tostring(element_name)..";"..tostring(tooltip).."]") end