Selection anchoring and undo on a Mac

A text selection not only has a beginning and an end, but also an anchor. It is whether I started selecting from the beginning or from the end. It’s not displayed anywhere, but the operating system sets it and accounts for it.

If you select a text from left to right, the selection will be anchored on the left. When you use Shift+arrows, the end of the selection will be adjusted, while the beginning will stay intact. Conversely, if you select a text from right to left, the selection will be anchored on the right and Shift+arrows will adjust the beginning of the selection. This works even if the initial selection is made with a mouse, try it yourself.

In older Mac OS versions this was not implemented well in lists. In Finder, for example, when you clicked a file and then Shift-clicked another one that was above in the list, Shift+arrows would still adjust the bottom end of the selected range, not the top one. That was irritating. At some point Apple fixed it and Finder selections began to work correctly. In text selection, it worked right all the time that I remember.

But even in text, there is still a bug in Mac OS: when Undo restores a selection, it will reset its anchor to left.
At least in Mojave. Select some text from right to left, then try adjusting it with Shift-arrows—everything will work fine, the beginning of the selection will be changed. Then delete the text and put it back with ⌘Z. Now, Shift-arrows will adjust the end of the selection. Why, Apple?

It’s commonplace to praise Apple for their attention to detail. But there is actually a lot of such user interface sloppiness on their part, and always have been. In never occurred to me that there was such thing as a selection anchor when I used Windows, because in Windows, it always worked flawlessly.