Skip to content

Commit

Permalink
Merge #3807 Make grid ampersand workaround platform specific
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Mar 11, 2023
2 parents 5d7107b + 8c515d2 commit 897b789
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file.
- [Core] Mark new deps of upgrades as auto-installed (#3702 by: HebaruSan; reviewed: techman83)
- [GUI] Fix index -1 exception in Manage Instances (#3800 by: HebaruSan; reviewed: techman83)
- [Multiple] Cache path setting fixes (#3804 by: HebaruSan; reviewed: techman83)
- [GUI] Make grid ampersand workaround platform specific (#3807 by: HebaruSan; reviewed: techman83)

### Internal

Expand Down
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

0 comments on commit 897b789

Please sign in to comment.