Browse Source

Double-clicking in a `TextBox` with `PasswordChar` set selects all text when the password is not revealed. (#14973)

If the password text is revealed, the pre-existing word-based selection model remains (the closest word to the pointer position is selected.)

Related to https://github.com/AvaloniaUI/Avalonia/issues/14956
pull/14993/head
nil4 2 years ago
committed by GitHub
parent
commit
fd15b6bc9e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      src/Avalonia.Controls/TextBox.cs

7
src/Avalonia.Controls/TextBox.cs

@ -1578,6 +1578,13 @@ namespace Avalonia.Controls
break;
case 2:
if (IsPasswordBox && !RevealPassword)
{
// double-clicking in a cloaked single-line password box selects all text
// see https://github.com/AvaloniaUI/Avalonia/issues/14956
goto case 3;
}
if (!StringUtils.IsStartOfWord(text, caretIndex))
{
selectionStart = StringUtils.PreviousWord(text, caretIndex);

Loading…
Cancel
Save