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

fixed crash on long back press #60

Merged
merged 2 commits into from
Jul 7, 2014
Merged

fixed crash on long back press #60

merged 2 commits into from
Jul 7, 2014

Conversation

madhur
Copy link
Contributor

@madhur madhur commented Jul 7, 2014

The below change fixes the crash on long press on backspace key.

@@ -461,7 +461,7 @@ protected void onSelectionChanged(int selStart, int selEnd) {
for (TokenImageSpan span: spans) {
int spanEnd = text.getSpanEnd(span);
if (selStart <= spanEnd && text.getSpanStart(span) < selStart) {
setSelection(spanEnd + 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

You should add one to the span end in most cases (otherwise you can wind up with extra spaces in the text field after several deletes under some circumstances). So you should probably check to see if the spanEnd is equal to the length, and add one to it if it is not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got you. You are right. Updated the source as per your comment and it works 👍

mgod added a commit that referenced this pull request Jul 7, 2014
fixed crash on long back press
@mgod mgod merged commit 3936387 into splitwise:master Jul 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants