fix(PluginInstallerWindow): Escape imgui string formatting

This commit is contained in:
goat 2022-02-16 14:10:49 +01:00
parent c866c23d91
commit 623327d407
No known key found for this signature in database
GPG key ID: 7773BB5B43BA52E5

View file

@ -399,11 +399,11 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
if (ImGui.BeginPopupModal(modalTitle, ref this.feedbackModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar)) if (ImGui.BeginPopupModal(modalTitle, ref this.feedbackModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar))
{ {
ImGui.Text(Locs.FeedbackModal_Text(this.feedbackPlugin.Name)); ImGui.TextUnformatted(Locs.FeedbackModal_Text(this.feedbackPlugin.Name));
if (this.feedbackPlugin?.FeedbackMessage != null) if (this.feedbackPlugin?.FeedbackMessage != null)
{ {
ImGui.TextWrapped(this.feedbackPlugin.FeedbackMessage); ImGuiHelpers.SafeTextWrapped(this.feedbackPlugin.FeedbackMessage);
} }
if (this.pluginListUpdatable.Any( if (this.pluginListUpdatable.Any(
@ -1133,7 +1133,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
var cursor = ImGui.GetCursorPos(); var cursor = ImGui.GetCursorPos();
// Name // Name
ImGui.Text(label); ImGui.TextUnformatted(label);
// Download count // Download count
var downloadCountText = manifest.DownloadCount > 0 var downloadCountText = manifest.DownloadCount > 0
@ -1164,9 +1164,9 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
if (plugin is { IsBanned: true }) if (plugin is { IsBanned: true })
{ {
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
ImGui.TextWrapped(plugin.BanReason.IsNullOrEmpty() ImGuiHelpers.SafeTextWrapped(plugin.BanReason.IsNullOrEmpty()
? Locs.PluginBody_Banned ? Locs.PluginBody_Banned
: Locs.PluginBody_BannedReason(plugin.BanReason)); : Locs.PluginBody_BannedReason(plugin.BanReason));
ImGui.PopStyleColor(); ImGui.PopStyleColor();
} }
@ -1176,16 +1176,16 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
{ {
if (!string.IsNullOrWhiteSpace(manifest.Punchline)) if (!string.IsNullOrWhiteSpace(manifest.Punchline))
{ {
ImGui.TextWrapped(manifest.Punchline); ImGuiHelpers.SafeTextWrapped(manifest.Punchline);
} }
else if (!string.IsNullOrWhiteSpace(manifest.Description)) else if (!string.IsNullOrWhiteSpace(manifest.Description))
{ {
const int punchlineLen = 200; const int punchlineLen = 200;
var firstLine = manifest.Description.Split(new[] { '\r', '\n' })[0]; var firstLine = manifest.Description.Split(new[] { '\r', '\n' })[0];
ImGui.TextWrapped(firstLine.Length < punchlineLen ImGuiHelpers.SafeTextWrapped(firstLine.Length < punchlineLen
? firstLine ? firstLine
: firstLine[..punchlineLen]); : firstLine[..punchlineLen]);
} }
} }
@ -1225,7 +1225,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
ImGui.SameLine(); ImGui.SameLine();
var cursor = ImGui.GetCursorPos(); var cursor = ImGui.GetCursorPos();
ImGui.Text(log.Title); ImGui.TextUnformatted(log.Title);
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{log.Version}"); ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{log.Version}");
@ -1233,7 +1233,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
cursor.Y += ImGui.GetTextLineHeightWithSpacing(); cursor.Y += ImGui.GetTextLineHeightWithSpacing();
ImGui.SetCursorPos(cursor); ImGui.SetCursorPos(cursor);
ImGui.TextWrapped(log.Text); ImGuiHelpers.SafeTextWrapped(log.Text);
var endCursor = ImGui.GetCursorPos(); var endCursor = ImGui.GetCursorPos();
@ -1294,7 +1294,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
// Description // Description
if (!string.IsNullOrWhiteSpace(manifest.Description)) if (!string.IsNullOrWhiteSpace(manifest.Description))
{ {
ImGui.TextWrapped(manifest.Description); ImGuiHelpers.SafeTextWrapped(manifest.Description);
} }
ImGuiHelpers.ScaledDummy(5); ImGuiHelpers.ScaledDummy(5);
@ -1503,7 +1503,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
ImGui.Indent(); ImGui.Indent();
// Name // Name
ImGui.Text(manifest.Name); ImGui.TextUnformatted(manifest.Name);
// Download count // Download count
var downloadText = plugin.IsDev var downloadText = plugin.IsDev
@ -1533,7 +1533,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
// Description // Description
if (!string.IsNullOrWhiteSpace(manifest.Description)) if (!string.IsNullOrWhiteSpace(manifest.Description))
{ {
ImGui.TextWrapped(manifest.Description); ImGuiHelpers.SafeTextWrapped(manifest.Description);
} }
// Available commands (if loaded) // Available commands (if loaded)
@ -1548,7 +1548,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
ImGui.Dummy(ImGuiHelpers.ScaledVector2(10f, 10f)); ImGui.Dummy(ImGuiHelpers.ScaledVector2(10f, 10f));
foreach (var command in commands) foreach (var command in commands)
{ {
ImGui.TextWrapped($"{command.Key} → {command.Value.HelpMessage}"); ImGuiHelpers.SafeTextWrapped($"{command.Key} → {command.Value.HelpMessage}");
} }
} }
} }
@ -1617,7 +1617,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
{ {
ImGui.Text("Changelog:"); ImGui.Text("Changelog:");
ImGuiHelpers.ScaledDummy(2); ImGuiHelpers.ScaledDummy(2);
ImGui.TextWrapped(manifest.Changelog); ImGuiHelpers.SafeTextWrapped(manifest.Changelog);
} }
ImGui.EndChild(); ImGui.EndChild();