restore caret too if we are at the end of the buffer