Browse Source

Give the row-details text blob a minimum height

A one-line payload (short hex dump, tiny source-link document) rendered
as a squeezed strip barely taller than the row itself, which does not
read as an expandable details area. Floor the editor at 100px so the
details region stays visually recognisable regardless of payload size.

Assisted-by: Claude:claude-fable-5:Claude Code
pull/3945/head
Siegfried Pammer 2 months ago committed by Siegfried Pammer
parent
commit
4fd7946e2b
  1. 1
      ILSpy.Tests/Metadata/MetadataRowDetailsTests.cs
  2. 7
      ILSpy/Metadata/MetadataRowDetails.cs

1
ILSpy.Tests/Metadata/MetadataRowDetailsTests.cs

@ -186,6 +186,7 @@ public class MetadataRowDetailsTests @@ -186,6 +186,7 @@ public class MetadataRowDetailsTests
editor.IsReadOnly.Should().BeTrue();
editor.WordWrap.Should().BeTrue();
editor.MaxHeight.Should().Be(400, "the host row must stay bounded; the editor scrolls internally");
editor.MinHeight.Should().Be(100, "a short payload must still get a recognisable details area, not a squeezed strip");
editor.SyntaxHighlighting.Should().NotBeNull();
editor.SyntaxHighlighting!.Name.Should().Be("C#");

7
ILSpy/Metadata/MetadataRowDetails.cs

@ -121,8 +121,10 @@ namespace ICSharpCode.ILSpy.Metadata @@ -121,8 +121,10 @@ namespace ICSharpCode.ILSpy.Metadata
/// in the decompiler-view-styled AvaloniaEdit editor: text payloads are mostly code,
/// so they get syntax colours (selected by <paramref name="highlightExtension"/>,
/// e.g. ".cs" or ".json"; <see langword="null"/> stays plain) and line virtualization
/// keeps large embedded-source documents cheap. Height is bounded so the host row
/// cannot grow unbounded; the editor scrolls internally.
/// keeps large embedded-source documents cheap. Height is bounded in both directions:
/// capped so the host row cannot grow unbounded (the editor scrolls internally), and
/// floored so a short payload still reads as a details area rather than a squeezed
/// one-line strip.
/// </summary>
public static Control BuildTextBlob(string text, string? highlightExtension = null)
{
@ -131,6 +133,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -131,6 +133,7 @@ namespace ICSharpCode.ILSpy.Metadata
Text = text,
IsReadOnly = true,
WordWrap = true,
MinHeight = 100,
MaxHeight = 400,
};
if (highlightExtension != null)

Loading…
Cancel
Save