Previously, when pressing left or right without Shift pressed, the cursor would end up one character left or right of the start of the selection, which is not expected behavior compared to how most programs handle this case. This commit changes this behavior to place the cursor at the start or end of the selection when pressing left or right, respectively, when a selection is active.