From 3b576b02f548e792f4e22ae784e3113c692c324e Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 3 Feb 2026 12:47:55 +0800 Subject: [PATCH] fix: left `LineNumberMargin` in text editor did not update its width Signed-off-by: leo --- src/Views/TextDiffView.axaml.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Views/TextDiffView.axaml.cs b/src/Views/TextDiffView.axaml.cs index c5e501c4..11ddd0a6 100644 --- a/src/Views/TextDiffView.axaml.cs +++ b/src/Views/TextDiffView.axaml.cs @@ -115,12 +115,6 @@ namespace SourceGit.Views return new Size(test.Width, 0); } - protected override void OnDataContextChanged(EventArgs e) - { - base.OnDataContextChanged(e); - InvalidateMeasure(); - } - private readonly bool _usePresenter; private readonly bool _isOld; } @@ -585,6 +579,13 @@ namespace SourceGit.Views protected override void OnDataContextChanged(EventArgs e) { base.OnDataContextChanged(e); + + foreach (var margin in TextArea.LeftMargins) + { + if (margin is LineNumberMargin) + margin.InvalidateMeasure(); + } + AutoScrollToFirstChange(); }