1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 05:32:54 +08:00

Merge pull request #11759 from peppy/chat-show-url-in-tooltips

Show URLs in tooltips when custom text has replaced the link
This commit is contained in:
Dan Balasescu 2021-02-12 16:04:55 +09:00 committed by GitHub
commit 267869bd0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,7 +38,12 @@ namespace osu.Game.Graphics.Containers
foreach (var link in links)
{
AddText(text[previousLinkEnd..link.Index]);
AddLink(text.Substring(link.Index, link.Length), link.Action, link.Argument ?? link.Url);
string displayText = text.Substring(link.Index, link.Length);
string linkArgument = link.Argument ?? link.Url;
string tooltip = displayText == link.Url ? null : link.Url;
AddLink(displayText, link.Action, linkArgument, tooltip);
previousLinkEnd = link.Index + link.Length;
}
@ -52,7 +57,7 @@ namespace osu.Game.Graphics.Containers
=> createLink(AddText(text, creationParameters), new LinkDetails(LinkAction.Custom, null), tooltipText, action);
public void AddLink(string text, LinkAction action, string argument, string tooltipText = null, Action<SpriteText> creationParameters = null)
=> createLink(AddText(text, creationParameters), new LinkDetails(action, argument), null);
=> createLink(AddText(text, creationParameters), new LinkDetails(action, argument), tooltipText);
public void AddLink(IEnumerable<SpriteText> text, LinkAction action = LinkAction.External, string linkArgument = null, string tooltipText = null)
{