mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 11:44:59 +00:00
code_review: PR #652
* update localization for zh_CN and zh_TW * change the icon for `Icons.Lines.All` * reorder diff view toolbar buttons * move private methods after protected Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
8d4afafd2d
commit
6209326fe0
5 changed files with 42 additions and 39 deletions
|
@ -1241,34 +1241,6 @@ namespace SourceGit.Views
|
|||
set => SetValue(EnableChunkSelectionProperty, value);
|
||||
}
|
||||
|
||||
private void RefreshContent(Models.TextDiff diff, bool keepScrollOffset = true)
|
||||
{
|
||||
if (SelectedChunk != null)
|
||||
SetCurrentValue(SelectedChunkProperty, null);
|
||||
|
||||
if (diff == null)
|
||||
{
|
||||
Editor.Content = null;
|
||||
GC.Collect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (UseSideBySideDiff)
|
||||
{
|
||||
var previousContent = Editor.Content as ViewModels.TwoSideTextDiff;
|
||||
Editor.Content = new ViewModels.TwoSideTextDiff(diff, keepScrollOffset ? previousContent : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!keepScrollOffset)
|
||||
diff.ScrollOffset = Vector.Zero;
|
||||
Editor.Content = diff;
|
||||
}
|
||||
|
||||
IsUnstagedChange = diff.Option.IsUnstaged;
|
||||
EnableChunkSelection = diff.Option.WorkingCopyChange != null;
|
||||
}
|
||||
|
||||
static TextDiffView()
|
||||
{
|
||||
UseSideBySideDiffProperty.Changed.AddClassHandler<TextDiffView>((v, _) =>
|
||||
|
@ -1316,6 +1288,34 @@ namespace SourceGit.Views
|
|||
SetCurrentValue(SelectedChunkProperty, null);
|
||||
}
|
||||
|
||||
private void RefreshContent(Models.TextDiff diff, bool keepScrollOffset = true)
|
||||
{
|
||||
if (SelectedChunk != null)
|
||||
SetCurrentValue(SelectedChunkProperty, null);
|
||||
|
||||
if (diff == null)
|
||||
{
|
||||
Editor.Content = null;
|
||||
GC.Collect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (UseSideBySideDiff)
|
||||
{
|
||||
var previousContent = Editor.Content as ViewModels.TwoSideTextDiff;
|
||||
Editor.Content = new ViewModels.TwoSideTextDiff(diff, keepScrollOffset ? previousContent : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!keepScrollOffset)
|
||||
diff.ScrollOffset = Vector.Zero;
|
||||
Editor.Content = diff;
|
||||
}
|
||||
|
||||
IsUnstagedChange = diff.Option.IsUnstaged;
|
||||
EnableChunkSelection = diff.Option.WorkingCopyChange != null;
|
||||
}
|
||||
|
||||
private void OnStageChunk(object _1, RoutedEventArgs _2)
|
||||
{
|
||||
var chunk = SelectedChunk;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue