Fix selection when inserting a caption

Change-Id: Ifad4cd11de0059dbc309da5b3c413ea98240292d