Skip to content

Commit 73b9ade

Browse files
committed
code_style: it's not necessary to make GetLines virtual
Signed-off-by: leo <longshuang@msn.cn>
1 parent f318eca commit 73b9ade

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

src/Views/TextDiffView.axaml.cs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,6 @@ public ThemedTextDiffPresenter(TextArea area, TextDocument doc) : base(area, doc
478478
TextArea.TextView.LineTransformers.Add(_lineStyleTransformer);
479479
}
480480

481-
public virtual List<Models.TextDiffLine> GetLines()
482-
{
483-
return [];
484-
}
485-
486481
public virtual void UpdateSelectedChunk(double y)
487482
{
488483
}
@@ -745,6 +740,17 @@ protected void TrySetChunk(ViewModels.TextDiffSelectedChunk chunk)
745740
SetCurrentValue(SelectedChunkProperty, chunk);
746741
}
747742

743+
private List<Models.TextDiffLine> GetLines()
744+
{
745+
if (DataContext is ViewModels.CombinedTextDiff combined)
746+
return combined.Data.Lines;
747+
748+
if (DataContext is ViewModels.TwoSideTextDiff twoSides)
749+
return IsOld ? twoSides.Old : twoSides.New;
750+
751+
return [];
752+
}
753+
748754
private void UpdateTextMate()
749755
{
750756
if (UseSyntaxHighlighting)
@@ -883,13 +889,6 @@ public class CombinedTextDiffPresenter : ThemedTextDiffPresenter
883889
TextArea.LeftMargins.Add(new LineModifyTypeMargin());
884890
}
885891

886-
public override List<Models.TextDiffLine> GetLines()
887-
{
888-
if (DataContext is ViewModels.CombinedTextDiff { Data: { } diff })
889-
return diff.Lines;
890-
return [];
891-
}
892-
893892
public override void UpdateSelectedChunk(double y)
894893
{
895894
if (DataContext is not ViewModels.CombinedTextDiff { Data: { } diff } combined)
@@ -1062,13 +1061,6 @@ public class SingleSideTextDiffPresenter : ThemedTextDiffPresenter
10621061
TextArea.LeftMargins.Add(new LineModifyTypeMargin());
10631062
}
10641063

1065-
public override List<Models.TextDiffLine> GetLines()
1066-
{
1067-
if (DataContext is ViewModels.TwoSideTextDiff diff)
1068-
return IsOld ? diff.Old : diff.New;
1069-
return [];
1070-
}
1071-
10721064
public override void UpdateSelectedChunk(double y)
10731065
{
10741066
if (DataContext is not ViewModels.TwoSideTextDiff diff)

0 commit comments

Comments
 (0)