Fix shell profile radio button line-ending binding (#257)
* Fix shell profile radio button line-ending binding Only change when updated from a checked radio button * Fix cancelling profile edit showing default line translation * call NotifyPropertyChanged
This commit is contained in:
1 parent
ed4a5adb16
commit
363f885aea
1 file changed
+6
-19
@@ -30,7 +30,6 @@ namespace FluentTerminal.App.ViewModels
|
||||
private string _workingDirectory;
|
||||
private readonly IApplicationView _applicationView;
|
||||
private readonly IDefaultValueProvider _defaultValueProvider;
|
||||
private bool _editingLineEndingStyle;
|
||||
|
||||
public ShellProfileViewModel(ShellProfile shellProfile, ISettingsService settingsService, IDialogService dialogService, IFileSystemService fileSystemService, IApplicationView applicationView, IDefaultValueProvider defaultValueProvider, Boolean isNew)
|
||||
{
|
||||
@@ -200,44 +199,31 @@ namespace FluentTerminal.App.ViewModels
|
||||
public LineEndingStyle LineEndingStyle
|
||||
{
|
||||
get => _lineEndingStyle;
|
||||
set
|
||||
{
|
||||
if (_lineEndingStyle != value && !_editingLineEndingStyle)
|
||||
{
|
||||
_editingLineEndingStyle = true;
|
||||
_lineEndingStyle = value;
|
||||
RaisePropertyChanged();
|
||||
RaisePropertyChanged(nameof(DoNotModifyIsSelected));
|
||||
RaisePropertyChanged(nameof(ToCRIsSelected));
|
||||
RaisePropertyChanged(nameof(ToCRLFIsSelected));
|
||||
RaisePropertyChanged(nameof(ToLFIsSelected));
|
||||
_editingLineEndingStyle = false;
|
||||
}
|
||||
}
|
||||
set => Set(ref _lineEndingStyle, value);
|
||||
}
|
||||
|
||||
public bool DoNotModifyIsSelected
|
||||
{
|
||||
get => LineEndingStyle == LineEndingStyle.DoNotModify;
|
||||
set => LineEndingStyle = LineEndingStyle.DoNotModify;
|
||||
set { if (value) LineEndingStyle = LineEndingStyle.DoNotModify; }
|
||||
}
|
||||
|
||||
public bool ToCRLFIsSelected
|
||||
{
|
||||
get => LineEndingStyle == LineEndingStyle.ToCRLF;
|
||||
set => LineEndingStyle = LineEndingStyle.ToCRLF;
|
||||
set { if (value) LineEndingStyle = LineEndingStyle.ToCRLF; }
|
||||
}
|
||||
|
||||
public bool ToLFIsSelected
|
||||
{
|
||||
get => LineEndingStyle == LineEndingStyle.ToLF;
|
||||
set => LineEndingStyle = LineEndingStyle.ToLF;
|
||||
set { if (value) LineEndingStyle = LineEndingStyle.ToLF; }
|
||||
}
|
||||
|
||||
public bool ToCRIsSelected
|
||||
{
|
||||
get => LineEndingStyle == LineEndingStyle.ToCR;
|
||||
set => LineEndingStyle = LineEndingStyle.ToCR;
|
||||
set { if (value) LineEndingStyle = LineEndingStyle.ToCR; }
|
||||
}
|
||||
|
||||
public void SaveChanges()
|
||||
@@ -370,6 +356,7 @@ namespace FluentTerminal.App.ViewModels
|
||||
_fallbackProfile = new ShellProfile
|
||||
{
|
||||
Arguments = Model.Arguments,
|
||||
LineEndingTranslation = Model.LineEndingTranslation,
|
||||
Location = Model.Location,
|
||||
Name = Model.Name,
|
||||
WorkingDirectory = Model.WorkingDirectory,
|
||||
|
||||
Reference in new issue
Block a user