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
Timob 6006: Implement setSelection for TextArea and TextField #2675
Conversation
Reviewed code and tested functionality. Approved. |
public void setSelection(int start, int end) | ||
{ | ||
int textLength = tv.length(); | ||
if (start < 0 || start > textLength || end < 0 || end > textLength) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be a better check. Start < 0 could default to start=0. End > textLength could default to end=textLength
Probably also good to check start<end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'start' doesn't have to be less than 'end'. setSelection(14,0) produces the same result as setSelection(0,14). If user specify invalid values for start or end, then the behavior is undefined. I think in this case it's better to print out a warning and do nothing instead of capping values and let end-developers think their values are correct.
Code Reviewed. Please address comments. |
PR ready for re-review. |
Reviewed with changes. Approved. |
Code Reviewed. ACCEPTED |
Functional Passed. Tested on Android Device 2.3.6. Was able to select text and set cursor as per description in docs. ACCEPTED |
Timob 6006: Implement setSelection for TextArea and TextField
Testing steps in JIRA: https://jira.appcelerator.org/browse/TIMOB-6006