Skip to content

Commit

Permalink
Merge pull request #5935 from DmitryZhelnin/fixes/5924-copy-from-read…
Browse files Browse the repository at this point in the history
…only-textbox

TextBox: update command states on selection changes
  • Loading branch information
maxkatz6 authored and danwalmsley committed May 19, 2021
1 parent 80d3d7f commit 7efb119
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Avalonia.Controls/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@ public int SelectionStart
set
{
value = CoerceCaretIndex(value);
SetAndRaise(SelectionStartProperty, ref _selectionStart, value);
var changed = SetAndRaise(SelectionStartProperty, ref _selectionStart, value);
if (changed)
{
UpdateCommandStates();
}
if (SelectionStart == SelectionEnd)
{
CaretIndex = SelectionStart;
Expand All @@ -281,7 +285,11 @@ public int SelectionEnd
set
{
value = CoerceCaretIndex(value);
SetAndRaise(SelectionEndProperty, ref _selectionEnd, value);
var changed = SetAndRaise(SelectionEndProperty, ref _selectionEnd, value);
if (changed)
{
UpdateCommandStates();
}
if (SelectionStart == SelectionEnd)
{
CaretIndex = SelectionEnd;
Expand Down

0 comments on commit 7efb119

Please sign in to comment.