Ken Kocienda

The original iPhone didn’t have cut/copy/paste. Infamous! The quickest explanation is that I didn’t have time to do it right. I had too much keyboard, autocorrection, and text system work to do. The design team didn’t have time either. So we passed on the feature for 1.0. https://t.co/SLncIxohkk

Eventually, I worked with the design team to implement cut/copy/paste. The magnifying text loupe was my idea. The goal was to have your finger right on the spot where the insertion point should go, while letting you see where that was.

At the end of editing text, lifting your finger off the screen could cause the insertion point to jitter and move between characters. Given the way that multitouch worked, this moment had a tiny bit of sensor noise. It usually didn’t matter, but for text editing, it did.

To fix this jitter, I implemented a touch history log just for text editing. When you lifted your finger off the screen while positioning the insertion point, I put the blinking cursor back in the spot it was in a couple hundred milliseconds before the final touch-end event.

About the text system, all editable styled text on the original iPhone was backed by WebKit. The system had itty bitty web pages sprinkled here and there. Every multiline UITextView was its own web page.

I was well prepared to do this work since I added text editing to WebKit in 2003-05. That was a hard project!

Every single-line UITextField grabbed a “field editor” that was shared among all text fields. I took that idea from AppKit—not sure where they got it from. Since only one text field was active at once, this worked. When inactive, UITextFields displayed an image of their contents.

I had the idea that the keyboard’s appearance should be “automatic”. Tapping into an editable text control would make the keyboard appear scroll the text being edited if the keyboard would cover it. Ending editing made the keyboard go away. The programmer need do nothing.

I also had the idea for matching the keyboard type to the each text field—for example, tapping into a phone number field would show a number pad. I called these things “text input traits”, and we would up with a bunch by time we shipped: caps lock, return key type, etc.

That’s it for now. Maybe more later. 👋

Sun Jun 19 14:59:32 +0000 2022