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
eddc1a91ce
commit
ad1263b0a8
2 changed files with 31 additions and 1 deletions
|
@ -51,6 +51,12 @@ namespace SourceGit.ViewModels
|
||||||
private set => SetProperty(ref _unifiedLines, value);
|
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)
|
public DiffContext(string repo, Models.DiffOption option, DiffContext previous = null)
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
|
@ -88,6 +94,7 @@ namespace SourceGit.ViewModels
|
||||||
textDiff.CurrentChangeBlockIdx = 0;
|
textDiff.CurrentChangeBlockIdx = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RefreshChangeBlockIndicator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NextChange()
|
public void NextChange()
|
||||||
|
@ -104,9 +111,22 @@ namespace SourceGit.ViewModels
|
||||||
textDiff.CurrentChangeBlockIdx = -1;
|
textDiff.CurrentChangeBlockIdx = -1;
|
||||||
textDiff.CurrentChangeBlockIdx = textDiff.ChangeBlocks.Count - 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()
|
public void ToggleFullTextDiff()
|
||||||
{
|
{
|
||||||
Preference.Instance.UseFullTextDiff = !Preference.Instance.UseFullTextDiff;
|
Preference.Instance.UseFullTextDiff = !Preference.Instance.UseFullTextDiff;
|
||||||
|
@ -251,6 +271,8 @@ namespace SourceGit.ViewModels
|
||||||
FileModeChange = latest.FileModeChange;
|
FileModeChange = latest.FileModeChange;
|
||||||
Content = rs;
|
Content = rs;
|
||||||
IsTextDiff = rs is Models.TextDiff;
|
IsTextDiff = rs is Models.TextDiff;
|
||||||
|
|
||||||
|
RefreshChangeBlockIndicator();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -315,6 +337,7 @@ namespace SourceGit.ViewModels
|
||||||
private string _title;
|
private string _title;
|
||||||
private string _fileModeChange = string.Empty;
|
private string _fileModeChange = string.Empty;
|
||||||
private int _unifiedLines = 4;
|
private int _unifiedLines = 4;
|
||||||
|
private string _changeBlockIndicator = "-/-";
|
||||||
private bool _isTextDiff = false;
|
private bool _isTextDiff = false;
|
||||||
private bool _ignoreWhitespace = false;
|
private bool _ignoreWhitespace = false;
|
||||||
private object _content = null;
|
private object _content = null;
|
||||||
|
|
|
@ -42,6 +42,13 @@
|
||||||
<Path Width="12" Height="12" Stretch="Uniform" Margin="0,6,0,0" Data="{StaticResource Icons.Up}"/>
|
<Path Width="12" Height="12" Stretch="Uniform" Margin="0,6,0,0" Data="{StaticResource Icons.Up}"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<TextBlock Classes="primary"
|
||||||
|
Margin="0,0,0,0"
|
||||||
|
Text="{Binding ChangeBlockIndicator}"
|
||||||
|
FontSize="11"
|
||||||
|
TextTrimming="CharacterEllipsis"
|
||||||
|
IsVisible="{Binding IsTextDiff}"/>
|
||||||
|
|
||||||
<Button Classes="icon_button"
|
<Button Classes="icon_button"
|
||||||
Width="28"
|
Width="28"
|
||||||
Click="OnGotoNextChange"
|
Click="OnGotoNextChange"
|
||||||
|
|
Loading…
Reference in a new issue