<commit_before>
/**
 * @module editor/shortcuts
 * @private
 */



/**
 * The index of this array is a keystroke combination as returned by the key
 * field of a JavaScript keyboard event as documented here:
 * https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
 * except for:
 * - `Escape`         → `Esc`
 * - `LeftArrow`...   → `Left/Right/Up/Down`
 * - `Delete`         → `Del`
 * - `Escape`         → `Esc`
 * - ' '            → `Spacebar`
 * 
 * The modifiers are specified before the main key, in the following order:
 * 1. `Ctrl`
 * 2. `Meta`: Command key on Mac OS. On Windows this is the Windows key,
 * but the system intercepts those key combinations so they are never received
 * 3. `Alt`: Option key on Mac OS
 * 4. `Shift`
 * 
 * The keys can be preceded by a context to restrict when the shortcut is 
 * applicable. For example, "math:Ctrl-KeyA" will restrict this shortcut
 * to only apply in the "math" context (parseMode). Other valid context include
 * "text" and "command".
 * 
 * The value of the entries represent the command to perform. 
 * This can be either a single selector, or an array of a selector followed
 * by its arguments.
 * Selectors uses the following naming conventions:
 * - a 'char' is a math atom (a letter, digit, symbol or compound atom)
 * - a 'word' is a sequence of math atoms of the same type
 * - a 'group' is a sequence of sibling atoms, for example a numerator or 
 * a superscript
 * - the 'MathField' is the entire expression being edited
 * - a 'placeholder' is either an actual placeholder atom or an empty child 
 * list, for example an empty numerator
 * - 'move' changes the position of the insertion point (and collapses the 
 * selection range if necessary)
 * - 'extend' keeps the anchor of the  selection, but moves the focus (extends,
 * or shrinks, the range of selected items)
 * 
 * @memberof module:editor/shortcuts
 * @type {Object<string,string>}
 */
const KEYBOARD_SHORTCUTS = {
    'Backspace':                'deletePreviousChar',
    'Alt-Backspace':            'deleteNextChar',

    'Del':                      'deleteNextChar',
    'Alt-Del':                  'deletePreviousChar',

    'Left':                     'moveToPreviousChar',
    'Shift-Left':               'extendToPreviousChar',
    'Ctrl-Left':                'moveToGroupStart',
    'Ctrl-Shift-Left':          'extendToGroupStart',
    'Alt-Left':                 'moveToPreviousWord',
    'Alt-Shift-Left':           'extendToPreviousWord',

    'Right':                    'moveToNextChar',
    'Ctrl-Right':               'moveToGroupEnd',
    'Ctrl-Shift-Right':         'extendToGroupEnd',
    'Shift-Right':              'extendToNextChar',
    'Alt-Right':                'moveToNextWord',
    'Alt-Shift-Right':          'extendToNextWord',

    'Home':                     'moveToMathFieldStart',
    'mac:Meta-Left':            'moveToMathFieldStart',
    'Shift-Home':               'extendToMathFieldStart',
    'mac:Meta-Shift-Left':      'extendToMathFieldStart',

    'End':                      'moveToMathFieldEnd',
    'mac:Meta-Right':           'moveToMathFieldEnd',
    'Shift-End':                'extendToMathFieldEnd',
    'mac:Meta-Shift-Right':     'extendToMathFieldEnd',

    'Up':                       'moveUp',
    'Shift-Up':                 'extendUp',
    'Down':                     'moveDown',
    'Shift-Down':               'extendDown',

    'Shift-Spacebar':           'moveBeforeParent',
    'Spacebar':                 'moveAfterParent',

    'PageUp':                   'moveToGroupStart',
    'PageDown':                 'moveToGroupEnd',

    'math:Tab':                 'moveToNextPlaceholder',
    'math:F8':                  'moveToNextPlaceholder',    // Visual Studio
    'math:Shift-Tab':           'moveToPreviousPlaceholder',
    'math:Shift-F8':            'moveToPreviousPlaceholder',    // Visual Studio

    'math:Esc':                 'enterCommandMode',
    'math:Backslash':           'enterCommandMode',
    'command:Spacebar':         'complete',
    'command:Esc':              'complete',
    'command:Tab':              'complete',
    'ios:command:Tab':          'nextSuggestion',
    'command:Return':           'complete',
    'command:Enter':            'complete',
    'command:Shift-Esc':        'complete',     // Some keyboards can't generate 
            // this combination, for example in 60% keyboards it is mapped to ~
    'command:Down':             'nextSuggestion',
    'command:Up':               'previousSuggestion',

    '!mac:math:Ctrl-KeyA':      'selectAll',
    'mac:math:Meta-KeyA':       'selectAll',
    '!mac:Ctrl-KeyZ':           'undo',
    'mac:Meta-KeyZ':            'undo',
    '!mac:Ctrl-KeyY':           'redo',             // ARIA recommendation
    'mac:Meta-Shift-KeyY':      'redo',
    '!mac:Ctrl-Shift-KeyZ':     'redo',
    'mac:Meta-Shift-KeyZ':      'redo',

    // Rare keys on some extended keyboards
    'Cut':                      'cut',
    'Copy':                     'copy',
    'Paste':                    'paste',
    'Undo':                     'undo',
    'Redo':                     'redo',
    'Clear':                    'delete',
    'EraseEof':                 'deleteToGroupEnd',


    // EMACS/MACOS BINDINGS
    'mac:Ctrl-KeyB':            'moveToPreviousChar',
    'mac:Ctrl-Shift-KeyB':      'extendToPreviousChar',
    'mac:Ctrl-KeyF':            'moveToNextChar',
    'mac:Ctrl-Shift-KeyF':      'extendToNextChar',
    'mac:Ctrl-Alt-KeyB':        'moveToPreviousWord',
    'mac:Ctrl-Shift-Alt-KeyB':  'extendToPreviousWord',
    'mac:Ctrl-Alt-KeyF':        'moveToNextWord',
    'mac:Ctrl-Shift-Alt-KeyF':  'extendToNextWord',
    'mac:Ctrl-KeyA':            'moveToMathFieldStart',    
    'mac:Ctrl-Shift-KeyA':      'extendToMathFieldStart',    
    'mac:Ctrl-KeyE':            'moveToMathFieldEnd',
    'mac:Ctrl-Shift-KeyE':      'extendToMathFieldEnd',
    'mac:Ctrl-KeyP':            'moveUp',
    'mac:Ctrl-Shift-KeyP':      'extendUp',
    'mac:Ctrl-KeyN':            'extendDown',
    'mac:Ctrl-KeyH':            'deletePreviousChar',
    'mac:Ctrl-KeyD':            'deleteNextChar',
    'mac:Ctrl-KeyL':            'scrollIntoView',
    'mac:Ctrl-KeyT':            'transpose',

    // WOLFRAM MATHEMATICA BINDINGS
    'math:Ctrl-Digit2':          ['insert', '\\sqrt{#0}'],
    'math:Ctrl-Digit5':          'moveToOpposite',
    'math:Ctrl-Digit6':          'moveToSuperscript',
    'math:Ctrl-Minus':           'moveToSubscript',
    'math:Alt-BracketLeft':      ['insert', '\\left[ #0 \\right]'],
    'math:Alt-Shift-BracketLeft':  ['insert', '\\left{ #0 \\right}'],
    'math:Ctrl-Enter':           'addRowAfter',
    'math:Ctrl-Comma':           'addColumnAfter',

    // MATHLIVE BINDINGS
    'math:Alt-KeyQ':             ['insert', '\\theta'],
    'math:Alt-KeyV':             ['insert', '\\sqrt{#0}'],
    'math:Alt-KeyP':             ['insert', '\\pi'],
    'math:Alt-Shift-KeyP':       ['insert', '\\prod_{i=#?}^{#?}'],
    'math:Alt-KeyW':             ['insert', '\\sum_{i=#?}^{#?}'],
    'math:Alt-KeyB':             ['insert', '\\int_{#?}^{#?}'],
    'math:Alt-KeyU':             ['insert', '\\cup'],
    'math:Alt-KeyN':             ['insert', '\\cap'],
    'math:Alt-Shift-KeyU':       ['insert', '\\bigcup'],
    'math:Alt-Shift-KeyN':       ['insert', '\\bigcap'],
    'math:Alt-Shift-KeyA':       ['insert', '\\forall'],
    'math:Alt-Shift-KeyE':       ['insert', '\\exists'],
    'math:Alt-Digit5':           ['insert', '\\infty'],      // "%" key
    'math:Alt-Digit6':           ['insert', '\\wedge'],      // "^" key
    'math:Alt-Shift-Digit6':     ['insert', '\\vee'],        // "^" key
    'math:Alt-Digit9':           ['insert', '('],            // "(" key, override smartFence
    'math:Alt-Digit0':           ['insert', ')'],            // ")" key, override smartFence
    'math:Alt-keyD':             ['insert', '\\differentialD'],
    'math:Alt-Shift-KeyD':       ['insert', '\\partial'],
    'math:Slash':                ['insert', '\\frac{#@}{#?}'],
    'math:Alt-Slash':            ['insert', '\\frac{#?}{#@}'],
    'math:Alt-KeyO':             ['insert', '\\emptyset'],
    'math:Alt-Shift-KeyO':       ['insert', '\\varnothing'],
<commit_msg>Fix #104. Numeric keypard "/" was ignored.<commit_after>
/**
 * @module editor/shortcuts
 * @private
 */



/**
 * The index of this array is a keystroke combination as returned by the key
 * field of a JavaScript keyboard event as documented here:
 * https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
 * except for:
 * - `Escape`         → `Esc`
 * - `LeftArrow`...   → `Left/Right/Up/Down`
 * - `Delete`         → `Del`
 * - `Escape`         → `Esc`
 * - ' '            → `Spacebar`
 * 
 * The modifiers are specified before the main key, in the following order:
 * 1. `Ctrl`
 * 2. `Meta`: Command key on Mac OS. On Windows this is the Windows key,
 * but the system intercepts those key combinations so they are never received
 * 3. `Alt`: Option key on Mac OS
 * 4. `Shift`
 * 
 * The keys can be preceded by a context to restrict when the shortcut is 
 * applicable. For example, "math:Ctrl-KeyA" will restrict this shortcut
 * to only apply in the "math" context (parseMode). Other valid context include
 * "text" and "command".
 * 
 * The value of the entries represent the command to perform. 
 * This can be either a single selector, or an array of a selector followed
 * by its arguments.
 * Selectors uses the following naming conventions:
 * - a 'char' is a math atom (a letter, digit, symbol or compound atom)
 * - a 'word' is a sequence of math atoms of the same type
 * - a 'group' is a sequence of sibling atoms, for example a numerator or 
 * a superscript
 * - the 'MathField' is the entire expression being edited
 * - a 'placeholder' is either an actual placeholder atom or an empty child 
 * list, for example an empty numerator
 * - 'move' changes the position of the insertion point (and collapses the 
 * selection range if necessary)
 * - 'extend' keeps the anchor of the  selection, but moves the focus (extends,
 * or shrinks, the range of selected items)
 * 
 * @memberof module:editor/shortcuts
 * @type {Object<string,string>}
 */
const KEYBOARD_SHORTCUTS = {
    'Backspace':                'deletePreviousChar',
    'Alt-Backspace':            'deleteNextChar',

    'Del':                      'deleteNextChar',
    'Alt-Del':                  'deletePreviousChar',

    'Left':                     'moveToPreviousChar',
    'Shift-Left':               'extendToPreviousChar',
    'Ctrl-Left':                'moveToGroupStart',
    'Ctrl-Shift-Left':          'extendToGroupStart',
    'Alt-Left':                 'moveToPreviousWord',
    'Alt-Shift-Left':           'extendToPreviousWord',

    'Right':                    'moveToNextChar',
    'Ctrl-Right':               'moveToGroupEnd',
    'Ctrl-Shift-Right':         'extendToGroupEnd',
    'Shift-Right':              'extendToNextChar',
    'Alt-Right':                'moveToNextWord',
    'Alt-Shift-Right':          'extendToNextWord',

    'Home':                     'moveToMathFieldStart',
    'mac:Meta-Left':            'moveToMathFieldStart',
    'Shift-Home':               'extendToMathFieldStart',
    'mac:Meta-Shift-Left':      'extendToMathFieldStart',

    'End':                      'moveToMathFieldEnd',
    'mac:Meta-Right':           'moveToMathFieldEnd',
    'Shift-End':                'extendToMathFieldEnd',
    'mac:Meta-Shift-Right':     'extendToMathFieldEnd',

    'Up':                       'moveUp',
    'Shift-Up':                 'extendUp',
    'Down':                     'moveDown',
    'Shift-Down':               'extendDown',

    'Shift-Spacebar':           'moveBeforeParent',
    'Spacebar':                 'moveAfterParent',

    'PageUp':                   'moveToGroupStart',
    'PageDown':                 'moveToGroupEnd',

    'math:Tab':                 'moveToNextPlaceholder',
    'math:F8':                  'moveToNextPlaceholder',    // Visual Studio
    'math:Shift-Tab':           'moveToPreviousPlaceholder',
    'math:Shift-F8':            'moveToPreviousPlaceholder',    // Visual Studio

    'math:Esc':                 'enterCommandMode',
    'math:Backslash':           'enterCommandMode',
    'math:IntlBackslash':       'enterCommandMode',
    'command:Spacebar':         'complete',
    'command:Esc':              'complete',
    'command:Tab':              'complete',
    'ios:command:Tab':          'nextSuggestion',
    'command:Return':           'complete',
    'command:Enter':            'complete',
    'command:Shift-Esc':        'complete',     // Some keyboards can't generate 
            // this combination, for example in 60% keyboards it is mapped to ~
    'command:Down':             'nextSuggestion',
    'command:Up':               'previousSuggestion',

    '!mac:math:Ctrl-KeyA':      'selectAll',
    'mac:math:Meta-KeyA':       'selectAll',
    '!mac:Ctrl-KeyZ':           'undo',
    'mac:Meta-KeyZ':            'undo',
    '!mac:Ctrl-KeyY':           'redo',             // ARIA recommendation
    'mac:Meta-Shift-KeyY':      'redo',
    '!mac:Ctrl-Shift-KeyZ':     'redo',
    'mac:Meta-Shift-KeyZ':      'redo',

    // Rare keys on some extended keyboards
    'Cut':                      'cut',
    'Copy':                     'copy',
    'Paste':                    'paste',
    'Undo':                     'undo',
    'Redo':                     'redo',
    'Clear':                    'delete',
    'EraseEof':                 'deleteToGroupEnd',


    // EMACS/MACOS BINDINGS
    'mac:Ctrl-KeyB':            'moveToPreviousChar',
    'mac:Ctrl-Shift-KeyB':      'extendToPreviousChar',
    'mac:Ctrl-KeyF':            'moveToNextChar',
    'mac:Ctrl-Shift-KeyF':      'extendToNextChar',
    'mac:Ctrl-Alt-KeyB':        'moveToPreviousWord',
    'mac:Ctrl-Shift-Alt-KeyB':  'extendToPreviousWord',
    'mac:Ctrl-Alt-KeyF':        'moveToNextWord',
    'mac:Ctrl-Shift-Alt-KeyF':  'extendToNextWord',
    'mac:Ctrl-KeyA':            'moveToMathFieldStart',    
    'mac:Ctrl-Shift-KeyA':      'extendToMathFieldStart',    
    'mac:Ctrl-KeyE':            'moveToMathFieldEnd',
    'mac:Ctrl-Shift-KeyE':      'extendToMathFieldEnd',
    'mac:Ctrl-KeyP':            'moveUp',
    'mac:Ctrl-Shift-KeyP':      'extendUp',
    'mac:Ctrl-KeyN':            'extendDown',
    'mac:Ctrl-KeyH':            'deletePreviousChar',
    'mac:Ctrl-KeyD':            'deleteNextChar',
    'mac:Ctrl-KeyL':            'scrollIntoView',
    'mac:Ctrl-KeyT':            'transpose',

    // WOLFRAM MATHEMATICA BINDINGS
    'math:Ctrl-Digit2':          ['insert', '\\sqrt{#0}'],
    'math:Ctrl-Digit5':          'moveToOpposite',
    'math:Ctrl-Digit6':          'moveToSuperscript',
    'math:Ctrl-Minus':           'moveToSubscript',
    'math:Alt-BracketLeft':      ['insert', '\\left[ #0 \\right]'],
    'math:Alt-Shift-BracketLeft':  ['insert', '\\left{ #0 \\right}'],
    'math:Ctrl-Enter':           'addRowAfter',
    'math:Ctrl-Comma':           'addColumnAfter',

    // MATHLIVE BINDINGS
    'math:Alt-KeyQ':             ['insert', '\\theta'],
    'math:Alt-KeyV':             ['insert', '\\sqrt{#0}'],
    'math:Alt-KeyP':             ['insert', '\\pi'],
    'math:Alt-Shift-KeyP':       ['insert', '\\prod_{i=#?}^{#?}'],
    'math:Alt-KeyW':             ['insert', '\\sum_{i=#?}^{#?}'],
    'math:Alt-KeyB':             ['insert', '\\int_{#?}^{#?}'],
    'math:Alt-KeyU':             ['insert', '\\cup'],
    'math:Alt-KeyN':             ['insert', '\\cap'],
    'math:Alt-Shift-KeyU':       ['insert', '\\bigcup'],
    'math:Alt-Shift-KeyN':       ['insert', '\\bigcap'],
    'math:Alt-Shift-KeyA':       ['insert', '\\forall'],
    'math:Alt-Shift-KeyE':       ['insert', '\\exists'],
    'math:Alt-Digit5':           ['insert', '\\infty'],      // "%" key
    'math:Alt-Digit6':           ['insert', '\\wedge'],      // "^" key
    'math:Alt-Shift-Digit6':     ['insert', '\\vee'],        // "^" key
    'math:Alt-Digit9':           ['insert', '('],            // "(" key, override smartFence
    'math:Alt-Digit0':           ['insert', ')'],            // ")" key, override smartFence
    'math:Alt-keyD':             ['insert', '\\differentialD'],
    'math:Alt-Shift-KeyD':       ['insert', '\\partial'],
    'math:Slash':                ['insert', '\\frac{#@}{#?}'],
    'math:Alt-Slash':            ['insert', '\\frac{#?}{#@}'],
    'math:NumpadDivide':         ['insert', '\\frac{#@}{#?}'],
    'math:Alt-NumpadDivide':     ['insert', '\\frac{#?}{#@}'],
    'math:Alt-KeyO':             ['insert', '\\emptyset'],
    'math:Alt-Shift-KeyO':       ['insert', '\\varnothing'],

{'fraction_non_alphanumeric': 0.16411600071458346, 'fraction_numerical': 0.0025605907223247783, 'mean_word_length': 1.9687113310942195, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1339177', 'n_tokens_mistral': 5277, 'n_tokens_neox': 5087, 'n_words': 1141}