diff --git a/ILSpy/TextView/DecompilerTextView.cs b/ILSpy/TextView/DecompilerTextView.cs index 76915ddec..f7771d9c6 100644 --- a/ILSpy/TextView/DecompilerTextView.cs +++ b/ILSpy/TextView/DecompilerTextView.cs @@ -394,7 +394,11 @@ namespace ICSharpCode.ILSpy.TextView public FlowDocumentTooltip(FlowDocument document) { TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display); - viewer = new FlowDocumentScrollViewer() { Width = document.MinPageWidth + 100 }; + double fontSize = DisplaySettingsPanel.CurrentDisplaySettings.SelectedFontSize; + viewer = new FlowDocumentScrollViewer() { + Width = document.MinPageWidth + fontSize * 5, + MaxWidth = MainWindow.Instance.ActualWidth + }; viewer.Document = document; Border border = new Border { Background = SystemColors.ControlBrush, @@ -405,7 +409,7 @@ namespace ICSharpCode.ILSpy.TextView }; this.Child = border; viewer.Foreground = SystemColors.InfoTextBrush; - document.FontSize = DisplaySettingsPanel.CurrentDisplaySettings.SelectedFontSize; + document.FontSize = fontSize; } public bool CloseWhenMouseMovesAway { diff --git a/ILSpy/TextView/XmlDocRenderer.cs b/ILSpy/TextView/XmlDocRenderer.cs index ac4ae7d18..14cd8c421 100644 --- a/ILSpy/TextView/XmlDocRenderer.cs +++ b/ILSpy/TextView/XmlDocRenderer.cs @@ -119,7 +119,7 @@ namespace ICSharpCode.ILSpy.TextView }; text.Inlines.AddRange(richText.CreateRuns(document)); text.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); - this.document.MinPageWidth = text.DesiredSize.Width; + this.document.MinPageWidth = Math.Min(text.DesiredSize.Width, MainWindow.Instance.ActualWidth); block.Inlines.AddRange(richText.CreateRuns(document)); block.FontFamily = GetCodeFont(); block.TextAlignment = TextAlignment.Left;