marijnh/CodeMirror — pull request #1537 by probertson (2013-05-20 19:52:49+00:00)
Title: Add Cmd+Delete and Cmd+Backspace shortcuts on Mac

Adds two shortcuts as defaults on the Mac:
- Cmd + Delete triggers killLine(), which deletes the text on a line after the cursor.
- Cmd + Backspace triggers a new killLineSmartStart() function, which deletes the text on the line before the cursor (but preserves leading whitespace on the line)

These are common shortcuts in code editors (and many other text-content editors), such as:
- Sublime Text 2
- TextEdit
- Eclipse
- Chrome (url bar, dev tools)
- and even Microsoft Outlook

I only added these as defaults to the Mac shortcuts because I'm not sure what the equivalents are on Windows and other configurations (or if there even is a common equivalent).

As mentioned above, part of this change involved creating a new function killLineSmartStart(). It is basically a mashup between killLine() and goLineSmartStart(). There is probably some room for removing code duplication between those functions and the new one, but I didn't want to go that far in modifying the library.