From 16ea6a31fcaf69e2ed3702a1c48bc6e076481e01 Mon Sep 17 00:00:00 2001 From: achal7 Date: Fri, 13 Apr 2018 17:56:25 +0530 Subject: [PATCH 1/2] 1) changed UpdateLastState to call UpdateLastState(TState) so that its the only one that has last update control 2) Clear function clean up the states, however currentNode by definition is depends upon one of the state value, hence made that also null, since there is nothing now to link --- src/Avalonia.Controls/Utils/UndoRedoHelper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Utils/UndoRedoHelper.cs b/src/Avalonia.Controls/Utils/UndoRedoHelper.cs index c76555e554..17cf681f15 100644 --- a/src/Avalonia.Controls/Utils/UndoRedoHelper.cs +++ b/src/Avalonia.Controls/Utils/UndoRedoHelper.cs @@ -59,7 +59,7 @@ namespace Avalonia.Controls.Utils public void UpdateLastState() { - _states.Last.Value = _host.UndoRedoState; + UpdateLastState(_host.UndoRedoState); } public void DiscardRedo() @@ -94,6 +94,7 @@ namespace Avalonia.Controls.Utils public void Clear() { _states.Clear(); + _currentNode = null; } bool WeakTimer.IWeakTimerSubscriber.Tick() From ad675ded5efb8a3e1c00e00c33f8de47b894ef2f Mon Sep 17 00:00:00 2001 From: temporaryuser0 <38496811+temporaryuser0@users.noreply.github.com> Date: Wed, 18 Apr 2018 14:04:13 +0200 Subject: [PATCH 2/2] Check if event was handled before in OnTextInput --- src/Avalonia.Controls/TextBox.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index 34c6b1cfd6..890926db54 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -275,8 +275,11 @@ namespace Avalonia.Controls protected override void OnTextInput(TextInputEventArgs e) { - HandleTextInput(e.Text); - e.Handled = true; + if (!e.Handled) + { + HandleTextInput(e.Text); + e.Handled = true; + } } private void HandleTextInput(string input)