diff --git a/ILSpy.Tests/Commands/HelpCommandTests.cs b/ILSpy.Tests/Commands/HelpCommandTests.cs index c1e9e3963..a0bf07eab 100644 --- a/ILSpy.Tests/Commands/HelpCommandTests.cs +++ b/ILSpy.Tests/Commands/HelpCommandTests.cs @@ -132,6 +132,20 @@ public class HelpCommandTests licenseTab.Text.Should().Contain("Permission is hereby granted"); } + [Test] + public void ResourceLinkGenerator_Does_Not_Require_Ctrl_Modifier_For_Click() + { + // AvaloniaEdit's TextEditorOptions.RequireControlModifierForHyperlinkClick only + // propagates to the *built-in* LinkElementGenerator via IBuiltinElementGenerator. + // FetchOptions; user-added subclasses keep whatever the base parameterless ctor sets + // (default true). The About-page generator must opt out explicitly so its links + // activate on a plain click. + var gen = new ResourceLinkGenerator( + "MIT License", + new System.Uri("resource:license.txt")); + gen.RequireControlModifierForClick.Should().BeFalse(); + } + [AvaloniaTest] public async Task Decompiler_Editor_Activates_Hyperlinks_Without_Ctrl_Modifier() { diff --git a/ILSpy/Commands/ResourceLinkGenerator.cs b/ILSpy/Commands/ResourceLinkGenerator.cs index 4ab920147..7c62f8539 100644 --- a/ILSpy/Commands/ResourceLinkGenerator.cs +++ b/ILSpy/Commands/ResourceLinkGenerator.cs @@ -36,6 +36,13 @@ namespace ILSpy.Commands : base(new Regex(Regex.Escape(phrase))) { this.target = target ?? throw new ArgumentNullException(nameof(target)); + // AvaloniaEdit's TextEditorOptions.RequireControlModifierForHyperlinkClick only + // propagates to its *built-in* LinkElementGenerator (via the + // IBuiltinElementGenerator.FetchOptions hook the editor invokes from + // UpdateBuiltinElementGeneratorsFromOptions). User-added subclasses inherit + // whatever the parameterless base constructor set (default true), so we have to + // opt out explicitly here. + RequireControlModifierForClick = false; } protected override Uri GetUriFromMatch(Match match) => target;