Use common Overlaps() logic

This actually fixes the problem and makes the tests pass
This commit is contained in:
Susko3 2023-12-01 01:08:22 +01:00
parent 30bdd2d4c0
commit d3517998cf

View File

@ -85,8 +85,8 @@ namespace osu.Game.Online.Chat
if (escapeChars != null)
displayText = escapeChars.Aggregate(displayText, (current, c) => current.Replace($"\\{c}", c.ToString()));
// Check for encapsulated links
if (result.Links.Find(l => (l.Index <= index && l.Index + l.Length >= index + m.Length) || (index <= l.Index && index + m.Length >= l.Index + l.Length)) == null)
// Check for overlapping links
if (!result.Links.Exists(l => l.Overlaps(index, m.Length)))
{
result.Text = result.Text.Remove(index, m.Length).Insert(index, displayText);