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
|
public bool IgnoreWhitespace
|
||||||
{
|
{
|
||||||
get => _ignoreWhitespace;
|
get => Preferences.Instance.IgnoreWhitespaceChangesInDiff;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (SetProperty(ref _ignoreWhitespace, value))
|
if (value != Preferences.Instance.IgnoreWhitespaceChangesInDiff)
|
||||||
|
{
|
||||||
|
Preferences.Instance.IgnoreWhitespaceChangesInDiff = value;
|
||||||
|
OnPropertyChanged();
|
||||||
LoadDiffContent();
|
LoadDiffContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string FileModeChange
|
public string FileModeChange
|
||||||
{
|
{
|
||||||
|
@ -62,7 +66,6 @@ namespace SourceGit.ViewModels
|
||||||
_content = previous._content;
|
_content = previous._content;
|
||||||
_fileModeChange = previous._fileModeChange;
|
_fileModeChange = previous._fileModeChange;
|
||||||
_unifiedLines = previous._unifiedLines;
|
_unifiedLines = previous._unifiedLines;
|
||||||
_ignoreWhitespace = previous._ignoreWhitespace;
|
|
||||||
_info = previous._info;
|
_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",
|
// 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.
|
// so instead we set a very high number for the "lines of context" parameter.
|
||||||
var numLines = Preferences.Instance.UseFullTextDiff ? 999999999 : _unifiedLines;
|
var numLines = Preferences.Instance.UseFullTextDiff ? 999999999 : _unifiedLines;
|
||||||
var latest = new Commands.Diff(_repo, _option, numLines, _ignoreWhitespace).Result();
|
var ignoreWS = Preferences.Instance.IgnoreWhitespaceChangesInDiff;
|
||||||
var info = new Info(_option, numLines, _ignoreWhitespace, latest);
|
var latest = new Commands.Diff(_repo, _option, numLines, ignoreWS).Result();
|
||||||
|
var info = new Info(_option, numLines, ignoreWS, latest);
|
||||||
if (_info != null && info.IsSame(_info))
|
if (_info != null && info.IsSame(_info))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -287,7 +291,6 @@ namespace SourceGit.ViewModels
|
||||||
private string _fileModeChange = string.Empty;
|
private string _fileModeChange = string.Empty;
|
||||||
private int _unifiedLines = 4;
|
private int _unifiedLines = 4;
|
||||||
private bool _isTextDiff = false;
|
private bool _isTextDiff = false;
|
||||||
private bool _ignoreWhitespace = false;
|
|
||||||
private object _content = null;
|
private object _content = null;
|
||||||
private Info _info = null;
|
private Info _info = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,6 +212,12 @@ namespace SourceGit.ViewModels
|
||||||
set => SetProperty(ref _useSyntaxHighlighting, value);
|
set => SetProperty(ref _useSyntaxHighlighting, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IgnoreWhitespaceChangesInDiff
|
||||||
|
{
|
||||||
|
get => _ignoreWhitespaceChangesInDiff;
|
||||||
|
set => SetProperty(ref _ignoreWhitespaceChangesInDiff, value);
|
||||||
|
}
|
||||||
|
|
||||||
public bool EnableDiffViewWordWrap
|
public bool EnableDiffViewWordWrap
|
||||||
{
|
{
|
||||||
get => _enableDiffViewWordWrap;
|
get => _enableDiffViewWordWrap;
|
||||||
|
@ -658,6 +664,7 @@ namespace SourceGit.ViewModels
|
||||||
private bool _useTwoColumnsLayoutInHistories = false;
|
private bool _useTwoColumnsLayoutInHistories = false;
|
||||||
private bool _displayTimeAsPeriodInHistories = false;
|
private bool _displayTimeAsPeriodInHistories = false;
|
||||||
private bool _useSideBySideDiff = false;
|
private bool _useSideBySideDiff = false;
|
||||||
|
private bool _ignoreWhitespaceChangesInDiff = false;
|
||||||
private bool _useSyntaxHighlighting = false;
|
private bool _useSyntaxHighlighting = false;
|
||||||
private bool _enableDiffViewWordWrap = false;
|
private bool _enableDiffViewWordWrap = false;
|
||||||
private bool _showHiddenSymbolsInDiffView = false;
|
private bool _showHiddenSymbolsInDiffView = false;
|
||||||
|
|
|
@ -66,10 +66,9 @@
|
||||||
CornerRadius="0,0,4,4">
|
CornerRadius="0,0,4,4">
|
||||||
<Grid ColumnDefinitions="*,Auto,Auto" Margin="0,4">
|
<Grid ColumnDefinitions="*,Auto,Auto" Margin="0,4">
|
||||||
<StackPanel Grid.Column="0"
|
<StackPanel Grid.Column="0"
|
||||||
Margin="8,0"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Orientation="Horizontal">
|
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" 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" 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"/>
|
<TextBlock Classes="primary" FontSize="11" Text="/" VerticalAlignment="Center"/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue