Fix caret position for the grid view sorting