(cm, e)
| 4136 | |
| 4137 | // Handle a key from the keydown event. |
| 4138 | function handleKeyBinding(cm, e) { |
| 4139 | var name = keyName(e, true); |
| 4140 | if (!name) return false; |
| 4141 | |
| 4142 | if (e.shiftKey && !cm.state.keySeq) { |
| 4143 | // First try to resolve full name (including 'Shift-'). Failing |
| 4144 | // that, see if there is a cursor-motion command (starting with |
| 4145 | // 'go') bound to the keyname without 'Shift-'. |
| 4146 | return dispatchKey(cm, "Shift-" + name, e, function(b) {return doHandleBinding(cm, b, true);}) |
| 4147 | || dispatchKey(cm, name, e, function(b) { |
| 4148 | if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion) |
| 4149 | return doHandleBinding(cm, b); |
| 4150 | }); |
| 4151 | } else { |
| 4152 | return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); }); |
| 4153 | } |
| 4154 | } |
| 4155 | |
| 4156 | // Handle a key from the keypress event |
| 4157 | function handleCharBinding(cm, e, ch) { |
no test coverage detected