Get the latest tech news
The Rake and its Prongs (2024)
We don’t think about this as we write: the blinking cursor tells a useful lie about what the text looks like, so we can work on an abstraction that is about the space between characters, and especially the space after the last character.
A test of NSRange.contains(_:) like this is not sufficient to cater to the user expectations I just mentioned: it will return false for the position of the blinking cursor right after a word. There's nothing beneath the blinking box this time, yet you can type there to append.If we hadn’t settled on this dual nature of editing text on digital devices with blinking cursors, including the position right after the last location that actually exists, aka typing ahead into the nether and letting the machine do the string expansion, we could not append at the at-the-end position like we do. (In actual teletyping hardware evolution, the text would be buffered so you can compose first, send later, and even delete characters in case of typos.)
Or read this on Hacker News