mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
code_style: run dotnet format
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
723263d099
commit
962055dd2a
4 changed files with 25 additions and 24 deletions
|
@ -40,19 +40,19 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
if (Blocks.Count == 0)
|
if (Blocks.Count == 0)
|
||||||
return "-/-";
|
return "-/-";
|
||||||
|
|
||||||
if (_current >= 0 && _current < Blocks.Count)
|
if (_current >= 0 && _current < Blocks.Count)
|
||||||
return $"{_current+1}/{Blocks.Count}";
|
return $"{_current + 1}/{Blocks.Count}";
|
||||||
|
|
||||||
return $"-/{Blocks.Count}";
|
return $"-/{Blocks.Count}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockNavigation(object context)
|
public BlockNavigation(object context)
|
||||||
{
|
{
|
||||||
Blocks.Clear();
|
Blocks.Clear();
|
||||||
Current = -1;
|
Current = -1;
|
||||||
|
|
||||||
var lines = new List<Models.TextDiffLine>();
|
var lines = new List<Models.TextDiffLine>();
|
||||||
if (context is Models.TextDiff combined)
|
if (context is Models.TextDiff combined)
|
||||||
lines = combined.Lines;
|
lines = combined.Lines;
|
||||||
|
@ -61,12 +61,12 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
if (lines.Count == 0)
|
if (lines.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var lineIdx = 0;
|
var lineIdx = 0;
|
||||||
var blockStartIdx = 0;
|
var blockStartIdx = 0;
|
||||||
var isNewBlock = true;
|
var isNewBlock = true;
|
||||||
var blocks = new List<Block>();
|
var blocks = new List<Block>();
|
||||||
|
|
||||||
foreach (var line in lines)
|
foreach (var line in lines)
|
||||||
{
|
{
|
||||||
lineIdx++;
|
lineIdx++;
|
||||||
|
@ -89,7 +89,7 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isNewBlock)
|
if (!isNewBlock)
|
||||||
blocks.Add(new Block(blockStartIdx, lines.Count - 1));
|
blocks.Add(new Block(blockStartIdx, lines.Count - 1));
|
||||||
|
|
||||||
|
@ -103,16 +103,18 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public Block GotoNext()
|
public Block GotoNext()
|
||||||
{
|
{
|
||||||
if (Blocks.Count == 0) return null;
|
if (Blocks.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
Current = (_current + 1) % Blocks.Count;
|
Current = (_current + 1) % Blocks.Count;
|
||||||
return Blocks[_current];
|
return Blocks[_current];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block GotoPrev()
|
public Block GotoPrev()
|
||||||
{
|
{
|
||||||
if (Blocks.Count == 0) return null;
|
if (Blocks.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
Current = _current == -1 ? Blocks.Count - 1 : (_current - 1 + Blocks.Count) % Blocks.Count;
|
Current = _current == -1 ? Blocks.Count - 1 : (_current - 1 + Blocks.Count) % Blocks.Count;
|
||||||
return Blocks[_current];
|
return Blocks[_current];
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace SourceGit.ViewModels
|
||||||
if (SetProperty(ref _revisionFileSearchFilter, value))
|
if (SetProperty(ref _revisionFileSearchFilter, value))
|
||||||
{
|
{
|
||||||
RevisionFileSearchSuggestion.Clear();
|
RevisionFileSearchSuggestion.Clear();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(value))
|
if (!string.IsNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
if (_revisionFiles.Count == 0)
|
if (_revisionFiles.Count == 0)
|
||||||
|
@ -132,7 +132,8 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
var files = new Commands.QueryRevisionFileNames(_repo.FullPath, sha).Result();
|
var files = new Commands.QueryRevisionFileNames(_repo.FullPath, sha).Result();
|
||||||
|
|
||||||
Dispatcher.UIThread.Invoke(() => {
|
Dispatcher.UIThread.Invoke(() =>
|
||||||
|
{
|
||||||
if (sha == Commit.SHA)
|
if (sha == Commit.SHA)
|
||||||
{
|
{
|
||||||
_revisionFiles.Clear();
|
_revisionFiles.Clear();
|
||||||
|
@ -795,7 +796,7 @@ namespace SourceGit.ViewModels
|
||||||
var suggestion = new List<string>();
|
var suggestion = new List<string>();
|
||||||
foreach (var file in _revisionFiles)
|
foreach (var file in _revisionFiles)
|
||||||
{
|
{
|
||||||
if (file.Contains(_revisionFileSearchFilter, StringComparison.OrdinalIgnoreCase) &&
|
if (file.Contains(_revisionFileSearchFilter, StringComparison.OrdinalIgnoreCase) &&
|
||||||
file.Length != _revisionFileSearchFilter.Length)
|
file.Length != _revisionFileSearchFilter.Length)
|
||||||
suggestion.Add(file);
|
suggestion.Add(file);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
|
|
@ -557,7 +557,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstLineIdx = DisplayRange.StartIdx;
|
var firstLineIdx = DisplayRange.StartIdx;
|
||||||
if (firstLineIdx <= 1)
|
if (firstLineIdx <= 1)
|
||||||
return;
|
return;
|
||||||
|
@ -600,7 +600,7 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GotoNextChange()
|
public void GotoNextChange()
|
||||||
{
|
{
|
||||||
var blockNavigation = BlockNavigation;
|
var blockNavigation = BlockNavigation;
|
||||||
if (blockNavigation != null)
|
if (blockNavigation != null)
|
||||||
{
|
{
|
||||||
|
@ -613,7 +613,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var lines = GetLines();
|
var lines = GetLines();
|
||||||
var lastLineIdx = DisplayRange.EndIdx;
|
var lastLineIdx = DisplayRange.EndIdx;
|
||||||
if (lastLineIdx >= lines.Count - 1)
|
if (lastLineIdx >= lines.Count - 1)
|
||||||
|
@ -724,7 +724,7 @@ namespace SourceGit.Views
|
||||||
oldValue.PropertyChanged -= OnBlockNavigationPropertyChanged;
|
oldValue.PropertyChanged -= OnBlockNavigationPropertyChanged;
|
||||||
if (newValue != null)
|
if (newValue != null)
|
||||||
newValue.PropertyChanged += OnBlockNavigationPropertyChanged;
|
newValue.PropertyChanged += OnBlockNavigationPropertyChanged;
|
||||||
|
|
||||||
InvalidateVisual();
|
InvalidateVisual();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1557,7 +1557,7 @@ namespace SourceGit.Views
|
||||||
get => GetValue(BlockNavigationProperty);
|
get => GetValue(BlockNavigationProperty);
|
||||||
set => SetValue(BlockNavigationProperty, value);
|
set => SetValue(BlockNavigationProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly StyledProperty<string> BlockNavigationIndicatorProperty =
|
public static readonly StyledProperty<string> BlockNavigationIndicatorProperty =
|
||||||
AvaloniaProperty.Register<TextDiffView, string>(nameof(BlockNavigationIndicator));
|
AvaloniaProperty.Register<TextDiffView, string>(nameof(BlockNavigationIndicator));
|
||||||
|
|
||||||
|
@ -1599,7 +1599,7 @@ namespace SourceGit.Views
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GotoPrevChange()
|
public void GotoPrevChange()
|
||||||
{
|
{
|
||||||
var presenter = this.FindDescendantOfType<ThemedTextDiffPresenter>();
|
var presenter = this.FindDescendantOfType<ThemedTextDiffPresenter>();
|
||||||
|
@ -1609,7 +1609,7 @@ namespace SourceGit.Views
|
||||||
presenter.GotoPrevChange();
|
presenter.GotoPrevChange();
|
||||||
if (presenter is SingleSideTextDiffPresenter singleSide)
|
if (presenter is SingleSideTextDiffPresenter singleSide)
|
||||||
singleSide.ForceSyncScrollOffset();
|
singleSide.ForceSyncScrollOffset();
|
||||||
|
|
||||||
BlockNavigationIndicator = BlockNavigation?.Indicator ?? string.Empty;
|
BlockNavigationIndicator = BlockNavigation?.Indicator ?? string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1622,7 +1622,7 @@ namespace SourceGit.Views
|
||||||
presenter.GotoNextChange();
|
presenter.GotoNextChange();
|
||||||
if (presenter is SingleSideTextDiffPresenter singleSide)
|
if (presenter is SingleSideTextDiffPresenter singleSide)
|
||||||
singleSide.ForceSyncScrollOffset();
|
singleSide.ForceSyncScrollOffset();
|
||||||
|
|
||||||
BlockNavigationIndicator = BlockNavigation?.Indicator ?? string.Empty;
|
BlockNavigationIndicator = BlockNavigation?.Indicator ?? string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue