Skip to content

Commit

Permalink
Double-clicking in a TextBox with PasswordChar set selects all te…
Browse files Browse the repository at this point in the history
…xt when the password is not revealed. (AvaloniaUI#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 AvaloniaUI#14956
  • Loading branch information
nil4 authored Mar 15, 2024
1 parent 0aba3ed commit fd15b6b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Avalonia.Controls/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,13 @@ protected override void OnPointerPressed(PointerPressedEventArgs e)

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);
Expand Down

0 comments on commit fd15b6b

Please sign in to comment.