feature: add a button in diff view to ignore all whitespace changes (--ignore-all-space)

This commit is contained in:
leo 2024-09-30 11:34:09 +08:00
parent c1f6da1b31
commit d2a005c532
No known key found for this signature in database
10 changed files with 44 additions and 17 deletions

View file

@ -17,6 +17,16 @@ namespace SourceGit.ViewModels
get => _title;
}
public bool IgnoreWhitespace
{
get => _ignoreWhitespace;
set
{
if (SetProperty(ref _ignoreWhitespace, value))
LoadDiffContent();
}
}
public string FileModeChange
{
get => _fileModeChange;
@ -57,6 +67,7 @@ namespace SourceGit.ViewModels
_isTextDiff = previous._isTextDiff;
_content = previous._content;
_unifiedLines = previous._unifiedLines;
_ignoreWhitespace = previous._ignoreWhitespace;
}
if (string.IsNullOrEmpty(_option.OrgPath) || _option.OrgPath == "/dev/null")
@ -98,7 +109,7 @@ namespace SourceGit.ViewModels
Task.Run(() =>
{
var latest = new Commands.Diff(_repo, _option, _unifiedLines).Result();
var latest = new Commands.Diff(_repo, _option, _unifiedLines, _ignoreWhitespace).Result();
var rs = null as object;
if (latest.TextDiff != null)
@ -237,6 +248,7 @@ namespace SourceGit.ViewModels
private int _unifiedLines = 4;
private bool _isLoading = true;
private bool _isTextDiff = false;
private bool _ignoreWhitespace = false;
private object _content = null;
}
}