Fix cursor position when dragged to the far right