save caret position when ending a list