Fix caret position when line contains tabs