mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
enhance: remember the last state of Ignore Whitespace Change and EOF
in text diff view (#1198)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
cf763b47c6
commit
9ba0b595d9
3 changed files with 17 additions and 8 deletions
|
@ -19,11 +19,15 @@ namespace SourceGit.ViewModels
|
|||
|
||||
public bool IgnoreWhitespace
|
||||
{
|
||||
get => _ignoreWhitespace;
|
||||
get => Preferences.Instance.IgnoreWhitespaceChangesInDiff;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _ignoreWhitespace, value))
|
||||
if (value != Preferences.Instance.IgnoreWhitespaceChangesInDiff)
|
||||
{
|
||||
Preferences.Instance.IgnoreWhitespaceChangesInDiff = value;
|
||||
OnPropertyChanged();
|
||||
LoadDiffContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +66,6 @@ namespace SourceGit.ViewModels
|
|||
_content = previous._content;
|
||||
_fileModeChange = previous._fileModeChange;
|
||||
_unifiedLines = previous._unifiedLines;
|
||||
_ignoreWhitespace = previous._ignoreWhitespace;
|
||||
_info = previous._info;
|
||||
}
|
||||
|
||||
|
@ -114,8 +117,9 @@ namespace SourceGit.ViewModels
|
|||
// There is no way to tell a git-diff to use "ALL lines of context",
|
||||
// so instead we set a very high number for the "lines of context" parameter.
|
||||
var numLines = Preferences.Instance.UseFullTextDiff ? 999999999 : _unifiedLines;
|
||||
var latest = new Commands.Diff(_repo, _option, numLines, _ignoreWhitespace).Result();
|
||||
var info = new Info(_option, numLines, _ignoreWhitespace, latest);
|
||||
var ignoreWS = Preferences.Instance.IgnoreWhitespaceChangesInDiff;
|
||||
var latest = new Commands.Diff(_repo, _option, numLines, ignoreWS).Result();
|
||||
var info = new Info(_option, numLines, ignoreWS, latest);
|
||||
if (_info != null && info.IsSame(_info))
|
||||
return;
|
||||
|
||||
|
@ -287,7 +291,6 @@ namespace SourceGit.ViewModels
|
|||
private string _fileModeChange = string.Empty;
|
||||
private int _unifiedLines = 4;
|
||||
private bool _isTextDiff = false;
|
||||
private bool _ignoreWhitespace = false;
|
||||
private object _content = null;
|
||||
private Info _info = null;
|
||||
}
|
||||
|
|
|
@ -212,6 +212,12 @@ namespace SourceGit.ViewModels
|
|||
set => SetProperty(ref _useSyntaxHighlighting, value);
|
||||
}
|
||||
|
||||
public bool IgnoreWhitespaceChangesInDiff
|
||||
{
|
||||
get => _ignoreWhitespaceChangesInDiff;
|
||||
set => SetProperty(ref _ignoreWhitespaceChangesInDiff, value);
|
||||
}
|
||||
|
||||
public bool EnableDiffViewWordWrap
|
||||
{
|
||||
get => _enableDiffViewWordWrap;
|
||||
|
@ -658,6 +664,7 @@ namespace SourceGit.ViewModels
|
|||
private bool _useTwoColumnsLayoutInHistories = false;
|
||||
private bool _displayTimeAsPeriodInHistories = false;
|
||||
private bool _useSideBySideDiff = false;
|
||||
private bool _ignoreWhitespaceChangesInDiff = false;
|
||||
private bool _useSyntaxHighlighting = false;
|
||||
private bool _enableDiffViewWordWrap = false;
|
||||
private bool _showHiddenSymbolsInDiffView = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue