mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Fixed bugs and added tests
This commit is contained in:
@ -41,6 +41,15 @@ namespace osu.Game.Online.Chat
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text that is displayed in chat.
|
||||
/// </summary>
|
||||
public string DisplayContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The links found in this message.
|
||||
/// </summary>
|
||||
/// <remarks>The links' positions are according to <see cref="DisplayContent"/></remarks>
|
||||
public List<Link> Links;
|
||||
|
||||
public Message(long? id)
|
||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Online.Chat
|
||||
//since we just changed the line display text, offset any already processed links.
|
||||
result.Links.ForEach(l => l.Index -= l.Index > index ? m.Length - displayText.Length : 0);
|
||||
|
||||
var details = getLinkDetails(link);
|
||||
var details = getLinkDetails(linkText);
|
||||
result.Links.Add(new Link(linkText, index, displayText.Length, linkActionOverride ?? details.linkType, details.linkArgument));
|
||||
|
||||
//adjust the offset for processing the current matches group.
|
||||
@ -119,7 +119,7 @@ namespace osu.Game.Online.Chat
|
||||
case "s":
|
||||
case "beatmapsets":
|
||||
case "d":
|
||||
return (LinkAction.External, args[3]);
|
||||
return (LinkAction.OpenBeatmapSet, args[3]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ namespace osu.Game.Online.Chat
|
||||
{
|
||||
var result = format(inputMessage.Content);
|
||||
|
||||
inputMessage.Content = result.Text;
|
||||
inputMessage.DisplayContent = result.Text;
|
||||
|
||||
// Sometimes, regex matches are not in order
|
||||
result.Links.Sort();
|
||||
|
Reference in New Issue
Block a user