mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +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,13 +19,17 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string FileModeChange
|
||||
{
|
||||
|
@ -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;
|
||||
|
|
|
@ -66,10 +66,9 @@
|
|||
CornerRadius="0,0,4,4">
|
||||
<Grid ColumnDefinitions="*,Auto,Auto" Margin="0,4">
|
||||
<StackPanel Grid.Column="0"
|
||||
Margin="8,0"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Classes="info_label" FontSize="13" Text="{DynamicResource Text.CommitMessageTextBox.SubjectCount}"/>
|
||||
<TextBlock Classes="info_label" FontSize="13" HorizontalAlignment="Left" Margin="4,0,0,0" Text="{DynamicResource Text.CommitMessageTextBox.SubjectCount}"/>
|
||||
<TextBlock Classes="primary" Margin="8,0,0,0" FontSize="11" Text="{Binding #ThisControl.Subject.Length}" IsVisible="{Binding #ThisControl.Subject.Length, Converter={x:Static c:IntConverters.IsSubjectLengthGood}}" VerticalAlignment="Center"/>
|
||||
<TextBlock Classes="primary" Margin="8,0,0,0" FontSize="11" Foreground="DarkGoldenrod" Text="{Binding #ThisControl.Subject.Length}" IsVisible="{Binding #ThisControl.Subject.Length, Converter={x:Static c:IntConverters.IsSubjectLengthBad}}" VerticalAlignment="Center"/>
|
||||
<TextBlock Classes="primary" FontSize="11" Text="/" VerticalAlignment="Center"/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue