mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
Added indicator of current/total change-blocks in DiffView toolbar
This commit is contained in:
parent
cabf1e84d3
commit
52550fe53e
2 changed files with 31 additions and 1 deletions
|
@ -51,6 +51,12 @@ namespace SourceGit.ViewModels
|
|||
private set => SetProperty(ref _unifiedLines, value);
|
||||
}
|
||||
|
||||
public string ChangeBlockIndicator
|
||||
{
|
||||
get => _changeBlockIndicator;
|
||||
private set => SetProperty(ref _changeBlockIndicator, value);
|
||||
}
|
||||
|
||||
public DiffContext(string repo, Models.DiffOption option, DiffContext previous = null)
|
||||
{
|
||||
_repo = repo;
|
||||
|
@ -88,6 +94,7 @@ namespace SourceGit.ViewModels
|
|||
textDiff.CurrentChangeBlockIdx = 0;
|
||||
}
|
||||
}
|
||||
RefreshChangeBlockIndicator();
|
||||
}
|
||||
|
||||
public void NextChange()
|
||||
|
@ -104,9 +111,22 @@ namespace SourceGit.ViewModels
|
|||
textDiff.CurrentChangeBlockIdx = -1;
|
||||
textDiff.CurrentChangeBlockIdx = textDiff.ChangeBlocks.Count - 1;
|
||||
}
|
||||
RefreshChangeBlockIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshChangeBlockIndicator()
|
||||
{
|
||||
string curr = "-", tot = "-";
|
||||
if (_content is Models.TextDiff textDiff)
|
||||
{
|
||||
if (textDiff.CurrentChangeBlockIdx >= 0)
|
||||
curr = (textDiff.CurrentChangeBlockIdx + 1).ToString();
|
||||
tot = (textDiff.ChangeBlocks.Count).ToString();
|
||||
}
|
||||
ChangeBlockIndicator = curr + "/" + tot;
|
||||
}
|
||||
|
||||
public void ToggleFullTextDiff()
|
||||
{
|
||||
Preference.Instance.UseFullTextDiff = !Preference.Instance.UseFullTextDiff;
|
||||
|
@ -251,7 +271,9 @@ namespace SourceGit.ViewModels
|
|||
FileModeChange = latest.FileModeChange;
|
||||
Content = rs;
|
||||
IsTextDiff = rs is Models.TextDiff;
|
||||
});
|
||||
|
||||
RefreshChangeBlockIndicator();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -315,6 +337,7 @@ namespace SourceGit.ViewModels
|
|||
private string _title;
|
||||
private string _fileModeChange = string.Empty;
|
||||
private int _unifiedLines = 4;
|
||||
private string _changeBlockIndicator = "-/-";
|
||||
private bool _isTextDiff = false;
|
||||
private bool _ignoreWhitespace = false;
|
||||
private object _content = null;
|
||||
|
|
|
@ -42,6 +42,13 @@
|
|||
<Path Width="12" Height="12" Stretch="Uniform" Margin="0,6,0,0" Data="{StaticResource Icons.Up}"/>
|
||||
</Button>
|
||||
|
||||
<TextBlock Classes="primary"
|
||||
Margin="0,0,0,0"
|
||||
Text="{Binding ChangeBlockIndicator}"
|
||||
FontSize="11"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
IsVisible="{Binding IsTextDiff}"/>
|
||||
|
||||
<Button Classes="icon_button"
|
||||
Width="28"
|
||||
Click="OnGotoNextChange"
|
||||
|
|
Loading…
Reference in a new issue