SourceCodeEditor: Suggester problem

I found a problem with Suggester in SourceCodeEditor.
If startPos = 0 (start position of the replacement) then SourceCodeEditor not replace text.
For startPos > 0 is ok.

@Install(to = "addEmailAddressesField", subject = "suggester")
private fun addEmailAddressesFieldSuggester(source: AutoCompleteSupport, text: String, cursorPosition: Int): List<Suggestion> {
    val suggestions: MutableList<Suggestion> = ArrayList()

    var searchText= ""
    var startPos=-1
    for (i in (cursorPosition-1) downTo 0){
        if (text[i]==' ' || text[i]==',' || text[i]==';' || text[i]=='\n' || i==0){
            startPos=if (i==0) 0 else i+1
            searchText=text.substring(startPos,cursorPosition).trim(' ',',',';','\n')

            .query("select e from app_AddressBook e where like :search or like :search order by,")
            .parameter("search", "$searchText%")
            .forEach { item->
                suggestions.add(Suggestion(source,,, null, startPos, -1))
    return suggestions


Hi, @marcin.zawadowicz!

It looks like a bug. I’ve created an issue cuba-platform/cuba#2711. We will investigate this behavior, thank you for reporting a problem!