src/edit/key_events.js
function handleKeyBinding(cm, e) {
  let name = keyName(e, true)
  if (!name) return false

  if (e.shiftKey && !cm.state.keySeq) {
    // First try to resolve full name (including 'Shift-'). Failing
    // that, see if there is a cursor-motion command (starting with
    // 'go') bound to the keyname without 'Shift-'.
    return dispatchKey(cm, "Shift-" + name, e, b => doHandleBinding(cm, b, true))
        || dispatchKey(cm, name, e, b => {
             if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
               return doHandleBinding(cm, b)
           })
  } else {
    return dispatchKey(cm, name, e, b => doHandleBinding(cm, b))
  }
}
function handleKeyBinding(cm, e) {
  let name = keyName(e, true)
  if (!name) return false

  if (e.shiftKey && !cm.state.keySeq) {
    // First try to resolve full name (including 'Shift-'). Failing
    // that, see if there is a cursor-motion command (starting with
    // 'go') bound to the keyname without 'Shift-'.
    return dispatchKey(cm, "Shift-" + name, e, b => doHandleBinding(cm, b, true))
        || dispatchKey(cm, name, e, b => {
             if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
               return doHandleBinding(cm, b)
           })
  } else {
    return dispatchKey(cm, name, e, b => doHandleBinding(cm, b))
  }
}
function handleKeyBinding ( cm , e ) { let name = keyName ( e , true ) if ( ! name ) return false if ( e . shiftKey && ! cm . state . keySeq ) { // First try to resolve full name (including 'Shift-'). Failing // that, see if there is a cursor-motion command (starting with // 'go') bound to the keyname without 'Shift-'. return dispatchKey ( cm , "Shift-" + name , e , b => doHandleBinding ( cm , b , true ) ) || dispatchKey ( cm , name , e , b => { if ( typeof b == "string" ? / ^go[A-Z] / . test ( b ) : b . motion ) return doHandleBinding ( cm , b ) } ) } else { return dispatchKey ( cm , name , e , b => doHandleBinding ( cm , b ) ) } }
Handle a key from the keydown event.
Handle a key from the keydown event .