preserve cursor position when retabing