Skip to content

Commit 6ed9c6f

Browse files
SmallJokerparamat
authored andcommittedSep 7, 2018
Menu content tab: Fix clipped description and missing depends (#7703)
1 parent a4f41e7 commit 6ed9c6f

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed
 

‎builtin/mainmenu/tab_content.lua

+21-24
Original file line numberDiff line numberDiff line change
@@ -81,50 +81,45 @@ local function get_formspec(tabview, name, tabdata)
8181
modscreenshot = defaulttexturedir .. "no_screenshot.png"
8282
end
8383

84+
local info = core.get_content_info(selected_pkg.path)
85+
local desc = fgettext("No package description available")
86+
if info.description and info.description:trim() ~= "" then
87+
desc = info.description
88+
end
89+
8490
retval = retval ..
8591
"image[5.5,0;3,2;" .. core.formspec_escape(modscreenshot) .. "]" ..
8692
"label[8.25,0.6;" .. core.formspec_escape(selected_pkg.name) .. "]" ..
87-
"label[5.5,1.7;".. fgettext("Information:") .. "]" ..
88-
"textlist[5.5,2.2;6.2,2.4;description;"
89-
90-
local info = core.get_content_info(selected_pkg.path)
91-
local desc = info.description or fgettext("No package description available")
92-
local descriptionlines = core.wrap_text(desc, 42, true)
93-
for i = 1, #descriptionlines do
94-
retval = retval .. core.formspec_escape(descriptionlines[i]) .. ","
95-
end
93+
"box[5.5,2.2;6.15,2.35;#000]"
9694

9795
if selected_pkg.type == "mod" then
9896
if selected_pkg.is_modpack then
99-
retval = retval .. ";0]" ..
97+
retval = retval ..
10098
"button[8.65,4.65;3.25,1;btn_mod_mgr_rename_modpack;" ..
10199
fgettext("Rename") .. "]"
102100
else
103101
--show dependencies
104-
local toadd_hard = table.concat(info.depends or {}, ",")
105-
local toadd_soft = table.concat(info.optional_depends or {}, ",")
102+
desc = desc .. "\n\n"
103+
local toadd_hard = table.concat(info.depends or {}, "\n")
104+
local toadd_soft = table.concat(info.optional_depends or {}, "\n")
106105
if toadd_hard == "" and toadd_soft == "" then
107-
retval = retval .. "," .. fgettext("No dependencies.")
106+
desc = desc .. fgettext("No dependencies.")
108107
else
109108
if toadd_hard ~= "" then
110-
retval = retval .. "," .. fgettext("Dependencies:") .. ","
111-
retval = retval .. toadd_hard
109+
desc = desc ..fgettext("Dependencies:") ..
110+
"\n" .. toadd_hard
112111
end
113112
if toadd_soft ~= "" then
114113
if toadd_hard ~= "" then
115-
retval = retval .. ","
114+
desc = desc .. "\n\n"
116115
end
117-
retval = retval .. "," .. fgettext("Optional dependencies:") .. ","
118-
retval = retval .. toadd_soft
116+
desc = desc .. fgettext("Optional dependencies:") ..
117+
"\n" .. toadd_soft
119118
end
120119
end
121-
122-
retval = retval .. ";0]"
123120
end
124121

125122
else
126-
retval = retval .. ";0]"
127-
128123
if selected_pkg.type == "txp" then
129124
if selected_pkg.enabled then
130125
retval = retval ..
@@ -138,8 +133,10 @@ local function get_formspec(tabview, name, tabdata)
138133
end
139134
end
140135

141-
retval = retval .. "button[5.5,4.65;3.25,1;btn_mod_mgr_delete_mod;"
142-
.. fgettext("Uninstall Package") .. "]"
136+
retval = retval .. "textarea[5.85,2.2;6.35,2.9;;" ..
137+
fgettext("Information:") .. ";" .. desc .. "]" ..
138+
"button[5.5,4.65;3.25,1;btn_mod_mgr_delete_mod;" ..
139+
fgettext("Uninstall Package") .. "]"
143140
end
144141
return retval
145142
end

0 commit comments

Comments
 (0)
Please sign in to comment.