Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UITextField setText: should move caret position of underlying TextBox to end. #502

Merged
merged 1 commit into from
May 24, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Frameworks/UIKit/UITextField.mm
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ - (void)setText:(NSString*)text {
_passwordBox.password = _text;
} else {
_textBox.text = _text;
// Ensure caret at end of field in case we programmatically
// gain focus (becomeFirstResponder) after the text is set:
_textBox.selectionStart = [_text length];
_textBox.selectionLength = 0;
Copy link
Contributor

@jaredhms jaredhms May 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want the same behavior for _passwordBox? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PasswordBox doesn't have the SelectionStart/Length properties. However it already implements the right functionality automatically. (I did the basic test which is to programmatically set the text then programmatically gain focus with a secureMode UITextField - the caret just appears at the end)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for validating


In reply to: 63553197 [](ancestors = 63553197)

}
[_secureModeLock unlock];
}
Expand Down