Skip to content
This repository was archived by the owner on Jun 29, 2025. It is now read-only.

Commit 6aae407

Browse files
committed
Fall back to description if missing tooltip
1 parent 472d331 commit 6aae407

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

PluginLoader/GUI/AddPluginMenu.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,27 @@ private void CreatePluginListItem(PluginData plugin, MyGuiControlParent panel)
314314
CanPlaySoundOnMouseOver = false,
315315
};
316316
layout.AddWithSize(description, MyAlignH.Left, MyAlignV.Top, 2, 0, 1, 2);
317-
if (!string.IsNullOrEmpty(plugin.Tooltip))
317+
if (string.IsNullOrEmpty(plugin.Tooltip))
318+
{
319+
string shortDescription = plugin.Description;
320+
if(!string.IsNullOrEmpty(shortDescription))
321+
{
322+
shortDescription = shortDescription.TrimStart();
323+
int firstEnter = shortDescription.IndexOf('\n');
324+
if (firstEnter < 0)
325+
firstEnter = shortDescription.Length - 1;
326+
if (firstEnter > 120)
327+
shortDescription = shortDescription.Substring(0, 117) + "...";
328+
else
329+
shortDescription = shortDescription.Substring(0, firstEnter + 1);
330+
description.AppendText(shortDescription);
331+
}
332+
}
333+
else
334+
{
318335
description.AppendText(plugin.Tooltip);
336+
}
337+
319338

320339
if (!plugin.IsLocal)
321340
{

0 commit comments

Comments
 (0)