Merge two ifs in NotesTextWatcher

This commit is contained in:
Christoph Loy 2020-03-06 23:41:33 +01:00 committed by Niedermann IT-Dienstleistungen
parent 8f8ae9772f
commit 5daf7fcc10

View file

@ -88,14 +88,12 @@ public abstract class NotesTextWatcher implements TextWatcher {
Log.v(TAG, "Entered a character directly behind a codeBlock - prepare selection reset to " + resetSelectionTo);
}
}
} else if (s.subSequence(startOfLine, start + count).toString().startsWith(codeBlock)) {
if (!resetSelection) {
} else if (s.subSequence(startOfLine, start + count).toString().startsWith(codeBlock) && !resetSelection) {
resetSelectionTo = editText.getSelectionEnd();
resetSelection = true;
Log.v(TAG, "One completed a ``-codeBlock with the third `-character - prepare selection reset to " + resetSelectionTo);
}
}
}
private void setNewText(@NonNull StringBuilder newText, int selection) {
editText.setText(newText);