add caret flicker function