ComposeTokenizer: try to fix test

main
Alibek Omarov 4 years ago
parent 09e5611ec0
commit c6219e3581
  1. 18
      app/src/main/java/com/keylesspalace/tusky/util/ComposeTokenizer.kt

@ -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
}
}

Loading…
Cancel
Save