Keyboard backspace is acting weird

Hey all!

I just made a short project to figure out how to use the keyboard, and I noticed something weird with the backspace button. After typing something in, if you hold down backspace it should continue to backspace on its own, but after doing this for a few seconds it stops. Anyone know why?

Thanks

--# Main
-- Keyboard

function setup()
    var = ""
    showKeyboard()
end

function draw()
    background(40, 40, 50)
    strokeWidth(5)
    fill(255, 255, 255, 255)
    text(var,WIDTH/2,HEIGHT*2/3)
end

function keyboard(key)
    if key == RETURN then
        hideKeyboard()
    else
        var = var..key
    end
    if key == BACKSPACE then
        var = string.sub(var,1,string.len(var)-1)
    end
    print(key)
end

function touched(touch)
    if not isKeyboardShowing() then showKeyboard() end
end

@Dwins Apparently there’s a built in limit of 22 characters. After deleting 22 characters it stops and requires you to single backspace. That’s probably meant to prevent you from deleting a lot of characters by mistake.

Right, that makes sense. Thanks @dave1707! Is that function just built into Codea? and if so, would that go away if I published something on the App Store?

@Dwins I would say it’s built into Codea and probably the same in a published app, but I can’t say that 100%. Maybe someone else could answer that.

On iOS, 22 characters is the point at which it jumps to deleting whole areas of text input.

Alright, good to know :slight_smile: