public void act() 
    {
        super.act();
        
        // Progress caret blinking animation.
        if (++blink == 20)
            blink = -20;
        
        oldCaret = caret;
        
        handleCopyCutPaste();
        
        handleMouse();
        
        if (hasFocus())
        {
            if (Greenfoot.isKeyDown("control") && Greenfoot.isKeyDown("a"))
            {
                selectingPivot = 0;
                caret = text.length();
            }
            
            handleInput();
            
            handleArrowKeys();
        }
        
        if (oldCaret != caret)
            lastCursorX = null;
        
        drawFunction.paint();
    }