ComposeTokenizer: try to fix test

This commit is contained in:
Alibek Omarov 2020-10-05 22:03:15 +03:00
parent ed2053b00f
commit e394eb6a5c

View File

@ -48,16 +48,20 @@ class ComposeTokenizer : MultiAutoCompleteTextView.Tokenizer {
// caught domain name, try search username
// don't ask me about this code
if(i > 3 && character == '@') {
i--
character = text[i - 1]
var j = i - 1
var character2 = text[i - 1]
while(i > 0 && character != '@') {
if(!isMentionOrHashtagAllowedCharacter(character)) {
return cursor
while(j > 0 && character2 != '@') {
if(!isMentionOrHashtagAllowedCharacter(character2)) {
break
}
i--
character = if (i == 0) ' ' else text[i - 1]
j--
character2 = if (i == 0) ' ' else text[i - 1]
}
if(character2 == '@') {
i = j
character = character2
}
}