Add a function for swapping two gems' positions, and use it when handling arrow keys on a locked cursor