Skip to content

Commit

Permalink
Merge pull request #1076 from wordpress-mobile/issue/1075-talkback-cr…
Browse files Browse the repository at this point in the history
…ash-dayone

Check for selectionStart being -1 to fix talkback crash in Day One
  • Loading branch information
khaykov authored Feb 26, 2024
2 parents 1aa0a85 + 56a3798 commit e204002
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ class IndentFormatter(editor: AztecText) : AztecFormatter(editor) {
* Checks whether any line of the selection can be outdented
*/
fun isOutdentAvailable(): Boolean {
if (selectionStart == -1) {
return false
}
val previousLineBreak = editableText.substring(0, selectionStart).lastIndexOf("\n")
if (previousLineBreak > 0 && selectionCanBeOutdented(previousLineBreak + 1, selectionStart)) {
return true
Expand Down

0 comments on commit e204002

Please sign in to comment.