Merge pull request #316 from AvaloniaUI/fix-is-replace-mode
Fix is replace mode
This commit is contained in:
Коммит
d9469b653c
|
@ -110,17 +110,6 @@ namespace AvaloniaEdit.Search
|
|||
public static readonly StyledProperty<bool> IsReplaceModeProperty =
|
||||
AvaloniaProperty.Register<SearchPanel, bool>(nameof(IsReplaceMode));
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Checks if replacemode is allowed
|
||||
/// </summary>
|
||||
/// <returns>False if editor is not null and readonly</returns>
|
||||
private static bool ValidateReplaceMode(SearchPanel panel, bool v1)
|
||||
{
|
||||
if (panel._textEditor == null || !v1) return v1;
|
||||
return !panel._textEditor.IsReadOnly;
|
||||
}
|
||||
|
||||
public bool IsReplaceMode
|
||||
{
|
||||
get => GetValue(IsReplaceModeProperty);
|
||||
|
|
|
@ -436,10 +436,15 @@ namespace AvaloniaEdit
|
|||
{
|
||||
if (e.Sender is TextEditor editor)
|
||||
{
|
||||
if ((bool)e.NewValue)
|
||||
editor.TextArea.ReadOnlySectionProvider = ReadOnlySectionDocument.Instance;
|
||||
else
|
||||
editor.TextArea.ReadOnlySectionProvider = NoReadOnlySections.Instance;
|
||||
bool isReadonly = e.GetNewValue<bool>();
|
||||
|
||||
editor.TextArea.ReadOnlySectionProvider = isReadonly ?
|
||||
ReadOnlySectionDocument.Instance :
|
||||
NoReadOnlySections.Instance;
|
||||
|
||||
if (editor.SearchPanel != null)
|
||||
editor.SearchPanel.IsReplaceMode = isReadonly ?
|
||||
false : editor.SearchPanel.IsReplaceMode;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
Загрузка…
Ссылка в новой задаче