Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make grid ampersand workaround platform specific #3807

Merged
merged 1 commit into from
Mar 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions GUI/Model/ModList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ private DataGridViewRow MakeRow(GUIMod mod, List<ModChange> changes, string inst
Value = "-"
};

var name = new DataGridViewTextBoxCell { Value = mod.Name.Replace("&", "&&") };
var author = new DataGridViewTextBoxCell { Value = string.Join(", ", mod.Authors).Replace("&", "&&") };
var name = new DataGridViewTextBoxCell { Value = ToGridText(mod.Name) };
var author = new DataGridViewTextBoxCell { Value = ToGridText(string.Join(", ", mod.Authors)) };

var installVersion = new DataGridViewTextBoxCell()
{
Expand Down Expand Up @@ -403,7 +403,7 @@ private DataGridViewRow MakeRow(GUIMod mod, List<ModChange> changes, string inst
var installSize = new DataGridViewTextBoxCell { Value = mod.InstallSize };
var releaseDate = new DataGridViewTextBoxCell { Value = mod.ToModule().release_date };
var installDate = new DataGridViewTextBoxCell { Value = mod.InstallDate };
var desc = new DataGridViewTextBoxCell { Value = mod.Abstract.Replace("&", "&&") };
var desc = new DataGridViewTextBoxCell { Value = ToGridText(mod.Abstract) };

item.Cells.AddRange(selecting, autoInstalled, updating, replacing, name, author, installVersion, latestVersion, compat, downloadSize, installSize, releaseDate, installDate, downloadCount, desc);

Expand All @@ -414,6 +414,9 @@ private DataGridViewRow MakeRow(GUIMod mod, List<ModChange> changes, string inst
return item;
}

private static string ToGridText(string text)
=> Platform.IsMono ? text.Replace("&", "&&") : text;

public Color GetRowBackground(GUIMod mod, bool conflicted, string instanceName)
{
if (conflicted)
Expand Down