Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fix back/forth URL bar selection ranges (#3505)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Jun 15, 2020
1 parent bf8da13 commit 418d959
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,12 @@ private void showSelectionMenu() {
public void onAction(String action) {
int startSelection = mBinding.urlEditText.getSelectionStart();
int endSelection = mBinding.urlEditText.getSelectionEnd();
boolean selectionValid = endSelection > startSelection;
boolean selectionValid = endSelection != startSelection;
if (startSelection > endSelection) {
int tmp = endSelection;
endSelection = startSelection;
startSelection = tmp;
}

if (action.equals(GeckoSession.SelectionActionDelegate.ACTION_CUT) && selectionValid) {
String selectedText = mBinding.urlEditText.getText().toString().substring(startSelection, endSelection);
Expand Down

0 comments on commit 418d959

Please sign in to comment.