fix some bugs related caret position in GuiDocument with inline images