enhance: stop render next inline elements when it is out of bounds

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-04-25 13:30:00 +08:00
parent 8c4362a98d
commit 1d16925e74
No known key found for this signature in database

View file

@ -97,8 +97,12 @@ namespace SourceGit.Views
return; return;
var height = Bounds.Height; var height = Bounds.Height;
var width = Bounds.Width;
foreach (var inline in _inlines) foreach (var inline in _inlines)
{ {
if (inline.X > width)
return;
if (inline.Element is { Type: Models.InlineElementType.Code}) if (inline.Element is { Type: Models.InlineElementType.Code})
{ {
var rect = new Rect(inline.X, (height - inline.Text.Height - 2) * 0.5, inline.Text.WidthIncludingTrailingWhitespace + 8, inline.Text.Height + 2); var rect = new Rect(inline.X, (height - inline.Text.Height - 2) * 0.5, inline.Text.WidthIncludingTrailingWhitespace + 8, inline.Text.Height + 2);