Commit 1b059b76 authored by Roger Yang's avatar Roger Yang
Browse files

Closes #5505: Fix Awesomebar text length calculation

parent d8b4d677
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -649,7 +649,7 @@ open class InlineAutocompleteEditText @JvmOverloads constructor(
        }

        override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
            textLengthBeforeChange = s.length
            textLengthBeforeChange = autoCompletePrefixLength
        }

        override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
+9 −0
Original line number Diff line number Diff line
@@ -283,6 +283,15 @@ class InlineAutocompleteEditTextTest {
        // Empty text isn't autocompleted either.
        et.setText("")
        assertEquals(1, invokedCounter)

        // Autocomplete for the first letter
        et.setText("t")
        assertEquals(2, invokedCounter)
        et.applyAutocompleteResult(AutocompleteResult("text", "source", 1))

        // Autocomplete should be called for the next letter that doesn't match the result
        et.setText("ta")
        assertEquals(3, invokedCounter)
    }

    @Test