Ever since MacOS 10.0 was released, text fields have supported Emacs bindings for the single-character Control commands, showing that there were people inside Apple (and, presumably, NeXT) who were right-thinking and sensible.
But some time late in the 10.6 release cycle, and continuing into 10.7.1, the binding for Ctrl-K ("kill to end of line") became broken.
I care deeply about this, because these commands have been burned into my hands' muscle memory since dinosaurs walked the earth, and every time it screws up, my brain basically falls over.
Proper behavior for "Kill" is this:
- If the last command was not "kill", truncate the kill buffer;
- Append the deleted text to the kill buffer.
Specifically, cursor motion, self-inserting characters, and basically everything else takes it out of kill-appends mode. The only time kills should append is if you type ^K twice in a row with no other intervening typing or motion.
This is how it used to work in 10.5.8 (I just tried it) and, I think, at least part of the way through the 10.6.x series. But it changed for some reason!
From my experiments, it seems that what Apple currently does is this:
Kill:
- If "no more kills" flag is set, truncate the kill buffer.
- Append the deleted text to the kill buffer.
Yank:
- Set "no more kills" flag.
- Insert contents of kill buffer.
That's wrong. Proper behavior is that if you kill text, move, kill more text, and yank, you get only the second text inserted. Current Mac behavior is that you get both pieces of text inserted -- in fact, all text that was killed since the last yank!
To demonstrate, type this into any text area (e.g., a Safari page with a form):
one ^A ^K ^Y RET
two RET
three RET
four RET
five RET
Then position the cursor at the beginning of the "two" line, and type this:
You should now be looking at:
But instead you have:
Is there any way for me to fix this myself? It appears that the key bindings are defined in /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict (a normal plist file) and available commands are listed in /System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSResponder.h, but I'm guessing there's no easy way to replace the definition of the deleteToEndOfParagraph: action with something else...
Update: For what it's worth (and for those who can read it) Apple Bug 10532310.
Update: Holy shit! I am told that this bug was fixed FIVE HOURS after I posted this -- Webkit bug 73888 and the patch. Thanks, Alexey!
This right here, people, is a grand triumph of open source.
Maybe the bug would have gotten the same kind of swift attention inside Apple (Alexey does work for Apple, after all) but none of us would have known that it had even been acknowledged until it showed up in a release, due to Apple's unconditional secrecy on all things. But because they do Webkit development out in the open, we all get to follow along! Which is awesome.
Of course I still have to wait who-knows-how-long until this fix is rolled into a build of Safari that I'm able to run, instead of being able to just spin my own or download a nightly like for normal software, so that's not ideal, but... baby steps.
Update 3, Aug 2012: The fix is in the Safari 6 release. So the answer is, "eight months".